Question: The following program redundantly repeats the same expressions many times. Modify the program to remove all redundant expressions using variables of appropriate types. public class

The following program redundantly repeats the same expressions many times. Modify the program to remove all redundant expressions using variables of appropriate types.

public class ComputePay { public static void main (String [] args) {

public class ComputePay { public static void main (String [] args) { 3. // Calculate pay at work based on hours worked each day 4 System.out.println ("My total hours worked:"); System.out.println (4 + 5 +8 + 4); System.out.println ("My hourly salary:"); 8 System.out.println ("$8.75"); 10 System.out.println ("My total pay:"); 11 System.out.println ( (4 +5 + 8 + 4) * 8.75); 12 13 System.out.println ("My taxes owed:"); // 20% tax System.out.println ( (4 + 5 + 8 +4) 0.20); 14 8.75 15 16 2. 9.

Step by Step Solution

3.40 Rating (159 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Version of ComputePay program that uses variables to avoi... View full answer

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 Building Java Programs A Back to Basics Approach Questions!