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: 69% (13 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...
-
If the toss of a coin comes down heads, you win two dollars. If it comes down tails, you lose fifty cents. How much would you expect to gain after 25 tosses (in 5 dollars)? $__ 1 points Save
-
7. Sold equipment at the end of its expected useful life. The equipment had no expected residual value when acquired (at a cost of $13,000), but it sold for $1,200.
-
A car dealer presently leases a small computer with software for $5000 per year. As an alternative he could purchase the computer for $7000 and lease the software for $3500 per year. Any time he...
-
The Campbell Company is considering adding a robotic paint sprayer to its production line. The sprayer's base price is $ 8 9 0 , 0 0 0 , and it would cost another $ 1 9 , 5 0 0 to install it . The...
-
Are the following functions analytic? Use (1) or (7). f(z) = Arg 2z
-
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...
-
A 1500-kg car moving east at 17 m/s collides with a 1800-kg car moving south at 15 m/s and the two cars stick together. (a) What is the velocity of the cars right after the collision? (b) How much...
-
Prove (11.32) . E (Yi,k | Zi = 0, = e) = E (Yi,k | i = 1, = e) = E (Yi,k | Ti = e), k = 1,2. (11.32)
-
University Medical Center needs to move from its existing facility to a new and larger facility five miles away from its current location. Due to construction delays, however, much of the new...
-
Calculate the base value or lump sum for each of the single and married filing jointly 2016 brackets given in Table 6.4. Table 6.4 ITABLE 6.4 Corporate Income Brackets and Tax Rates, 2015 Taxable...
-
Show that staged column diameter is proportional to (feed rate) \({ }^{1 / 2}\) and to \((1+\mathrm{L} / \mathrm{D})^{1 / 2}\).
-
An atmospheric column with 25 real stages is operating with a pressure drop of 0.6 in. of water per stage. Assume pressure drop in the condenser and the reboiler is \(1.2 \mathrm{in}\). of water...
-
Give systematic names to the following binary compounds. a. N 2 F 2 b. CF 4 c. N 2 O 5 d. As 4 O 6
-
What exactly is a prima facie duty? How does an ethic of prima facie duties differ from monistic and absolutist ethical theories?
-
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.
-
Docs Auto Body has budgeted the costs of the following repair time and parts activities for 2009: Doc's budgets 6,000 hours of repair time in 2009. A profit margin of $7 per labour hour will be added...
-
QUESTION 28 In a perpetual inventory system, the cost of inventory sold is: Debited to accounts receivable. Debited to cost of goods sold. O Not recorded at the time goods are sold. O Credited to...
-
The following financial statements and additional information are reported. IKIBAN INC. Comparative Balance Sheets June 30, 2019 and 2018 2019 2018 $105,709 69,500 66,800 4,700 246,700 127,eee...
Study smarter with the SolutionInn App