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 23:00
Which type of tab stop is most for weights and measurements?
Answers: 1
question
Computers and Technology, 23.06.2019 07:30
Which option allows you to view slides on the full computer screen?
Answers: 1
question
Computers and Technology, 23.06.2019 15:20
In a game with three frames, where will the objects on layer 1 appear? a. next to the play area b. in the middle of the game c. behind everything else d. in front of everything else
Answers: 1
question
Computers and Technology, 23.06.2019 18:30
How often does colleges update the cost of attendance on their website? . a)every two years b) every four years c) every year d) every semester
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, 13.12.2019 02:31
question
Mathematics, 13.12.2019 02:31
question
Mathematics, 13.12.2019 02:31
Questions on the website: 13722362