Question: JAVA Create a class named Tip. The main ( ) method performs the following tasks: o Define a final String constant containing your first and

JAVA Create a class named Tip.
The main() method performs the following tasks:
o Define a final String constant containing your first and last name
only (not mine)
o Print the title line in the console being sure to concatenate your
name constant, or use printf() to print the String constant as part of
the title line
o prompt the user to enter a subtotal (double), save value in variable
o prompt the user to enter the tip percentage (int enter as whole
number such as 18), save value in variable
o call calcTip() method passing the subtotal and tip percentage values,
save the returned calculated tip amount in a variable
o call the calcTotal() method passing the subtotal and tip amount, save
the returned total in a variable
o call the display() method passing the subtotal, tip percentage, tip
amount and total to be printed to the console
The calcTip() method will receive two parameters (from main() method)
representing the subtotal and tip percentage.
o convert tip percentage to double value as in 0.18
o calculate the tip amount (using subtotal and tip percentage), save
result in a variable
o return the calculated tip amount to the main() method
The calcTotal() method will receive two parameters (from main() method)
representing the subtotal and tip amount
o calculate the total (using subtotal and tip amount), save result in a
variable
o return the calculated total to the main() method
The display() method will receive 4 parameters (from main() method)
representing subtotal, tip percentage, tip amount, and total.
o Display the output in the console as depicted in Expected Output,
being sure to use the printf() method for proper formatting

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!