Question: The following program redundantly repeats the same expressions many times. Modify the program to remove all redundant expressions using variables of appropriate types. // This
The following program redundantly repeats the same expressions many times. Modify the program to remove all redundant expressions using variables of appropriate types.
![// This program computes the total amount owed for a meal, // assuming 8% tax and a 15% tip. public class Receipt { public static void main (String [] args) { System.out.println (](https://dsd5zvtm8ll6.cloudfront.net/si.question.images/images/question_images/1606/7/2/3/5155fc4a7bb4c53a1606723428247.jpg)
// This program computes the total amount owed for a meal, // assuming 8% tax and a 15% tip. public class Receipt { public static void main (String [] args) { System.out.println ("Subtotal:"); System.out.println (38 + 40 + 30); System.out.println ("Tax:"); System.out.println ((38 + 40 + 30) * .08); System.out.println ("Tip:"); System.out.println ( (38 + 40 + 30) * .15); System.out.println ("Total:"); System.out..println (38 + 40 + 30 + (38 + 40 + 30) * .08 + (38 + 40 + 30) * .15);
Step by Step Solution
3.32 Rating (161 Votes )
There are 3 Steps involved in it
This program computes the total amount owed for a meal assuming 8 tax and a 15 tip pub... View full answer
Get step-by-step solutions from verified subject matter experts
