The following program redundantly repeats the same expressions many times. Modify the program to remove all redundant
Question:
The following program redundantly repeats the same expressions many times. Modify the program to remove all redundant expressions using variables of appropriate types.
Transcribed Image Text:
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.
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 66% (12 reviews)
Version of ComputePay program that uses variables to avoi...View the full answer
Answered By
Kalyan M. Ranwa
I have more than seven years of teaching experience in physics and mechanical engineering.
5.00+
1+ Reviews
10+ Question Solved
Related Book For
Building Java Programs A Back To Basics Approach
ISBN: 9780135471944
5th Edition
Authors: Stuart Reges, Marty Stepp
Question Posted:
Students also viewed these Computer science questions
-
Modify the program Coin Tosses to toss coin n times and print out after every 100 tosses the proportion of heads minus 1/2. Do these numbers appear to approach 0 as n increases? Modify the program...
-
Truth table in C programming Please follow the instructions below and include comments and snipshot for explanation thanks. 1) Copy the C program below. This program generates the truth table for a...
-
Using the sample program results in Figure 5.33: a. How many levels of cache are there? b. What are the overall size and block size of the first-level cache? c. What is the miss penalty of the...
-
A rectangular plate lying on the xy plane has sides 2 in the x direction and in the y direction, thickness h in direction z, and is made of a material with Young's modulus E, Poisson's ratio v, and...
-
Air is compressed steadily by a compressor from 14.7 psia and 60F to 100 psia and 480F at a rate of 22 lbm/min. Assuming the surroundings to be at 60F, determine the minimum power input to the...
-
In Problem, find each limit, if it exists. [(x + h) 2(x + h)*] (x 2x) lim h 0 | h
-
The law of a machine is given by (a) \(W=m P-c\) (b) \(W=m P+c\) (c) \(P=m W-c\) (d) \(P=m W+c\)
-
Ludlow Plastics manufactures custom park furniture and signage from recycled plastics (primarily shredded milk jugs.) Many of the companys customers are municipalities that are required by law to...
-
2. Does the surveillance camera present any ethical or legal problems? Why or why not? 3. Explain any other legal issues regarding employee or employer rights that might apply. 4. Do you think the...
-
Allie has bought a new apple orchard. The orchard has a single file of trees, numbered from 1 to N. Each tree has a certail number of ripe apples. Allie has a rule she wants to follow. She wants to...
-
Write a Java program called StarFigure that produces the following output. Use nested for loops to capture the structure of the figure. //// * **1* // /*** ******* ////************ **\\\\ *** *** **...
-
Use your pseudocode from the previous exercise to write a Java program called Window that produces the preceding figure as output. Use nested for loops to print the repeated parts of the figure. Once...
-
On July 1, 2013, Wolfpack Corporation purchased securities which it intends to buy and sell frequently. These securities consisted of (a) Todd Corporation 10%, 5-year bonds with a face value of...
-
The length of a crystal increased from 0.1 mm to 0. 15 mm in 10 min. What is the growth rate if the crystal growth follows McCabes law?
-
How many stages are required to recovery 90% of a protein if the flow rate is 10 L/min, porosity is 0.33, partition coefficient is 54, bed volume is 100 L.
-
What role will technologies such as machine learning and other AI play fur the future of Amazon package delivery? How has Amazon acquired this data, and why does ownership of data present a challenge...
-
Estimate the Resolution between two peaks A and B if the time at which peak maximum occurs are 8 and 12 min, respectively. The widths at the base are 3 and 4 min, respectively.
-
Investigate and build a list of ten firms you find impressive that are using AWS. Include at least two firms that you might consider to be Amazon rivals.
-
Identical objects are located at the same distance from two spherical mirrors, A and B. The magnifications produced by the mirrors are mA = 4.0 and mB = 2.0. Find the ratio fA/fB of the focal lengths...
-
Derive Eq. (18.33) from Eq. (18.32).
-
Let T be a complete binary tree such that position p stores an element with key f (p), where f (p) is the level number of p (see Section 8.3.2). Is tree T a heap? Why or why not?
-
At which positions of a heap might the largest key be stored?
-
Give an example of a worst-case sequence with n elements for insertion-sort, and show that insertion-sort runs in (n 2 ) time on such a sequence.
-
How do you prioritize features and attributes when designing a new product or service? What steps should be taken to ensure that the design process aligns with the organization's overall strategy and...
-
Information that does not have an adjustment reason code to route payments into the correct bank accounts to relay about patient benefit coverage to indicate the amount being paid and the date of...
-
Superior Company provided the following data for the year ended December 31 (all raw materials are used in production as direct materials): Selling expenses Purchases of raw materials Direct labor...
Study smarter with the SolutionInn App