subject

Write a program that reads the subtotal and the gratuity rate, then computes the gratuity and the total. Round to the nearest cent. For example, if the user enters 10 for subtotal and 15% for gratuity rate, the program displays $1.5 as the gratuity and $11.5 as the total. Implementation: You will need to write a class MealCheck with a constructor Me alCheck(double subtotal, double gratuityRate) and methods double getGratuity() and double getTotal() to perform the calculations and return the results. Your program should prompt the user for a subtotal and a gratuity rate, then call the constructor to create an object, then call instance methods getGratuity() and getTotal().
Here is a sample run:
Enter the subtotal and the gratuity rate: 10 15
The gratuity is $1.5 and total is $11.5
Hints
Hints: Organize your code as follows: MealCheck class .
constructor to initialize rate and subtotal instance variables .
get Gratuity) method to calculate and return gratuity amount
getTotal() method to calculate and return total main method prompt user for input read subTotal and gratuityRate .
convert gratuityRate from percent to decimal .
create MealCheck object and call constructor with subTotal and gratuityRate arguments call getGratuity() and getTotal method:s from object .
print result

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 06:00
Pthe price of tickets in a group when a purchased in bulk can be found with the equation c=px+24 were c is the cost, p is the number of people,and x is the price per ticket. what is price of of each ticket if it costs $189 to buy tickets for 15 people ? a $8 b $24c $9d $11 show work
Answers: 1
question
Computers and Technology, 23.06.2019 00:30
Quic which one of the following is the most accurate definition of technology? a electronic tools that improve functionality b electronic tools that provide entertainment or practical value c any type of tool that serves a practical function d any type of tool that enhances communication
Answers: 1
question
Computers and Technology, 23.06.2019 07:00
You need a quick answer from a coworker. the most effective way to reach your coworker is through a. cloud server b. instant message c. teleconference d. telepresence
Answers: 1
question
Computers and Technology, 23.06.2019 09:00
Before you record your own voice, you should a. record other people's voices b. warm up and practice difficult names c. listen to your favorite songs d. read a transcript of a good radio news segment
Answers: 1
You know the right answer?
Write a program that reads the subtotal and the gratuity rate, then computes the gratuity and the to...
Questions
question
Mathematics, 11.03.2021 01:00
question
Mathematics, 11.03.2021 01:00
question
Mathematics, 11.03.2021 01:00
Questions on the website: 13722363