Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Electrician App: In the main method, ask how many rooms and the wire price per foot. Write a loop to call the Room Estimate method

Electrician App:

In the main method, ask how many rooms and the wire price per foot. Write a loop to call the Room Estimate method to get info for each room. Then call the Display Results method to print the results. Write a Room Estimate method (value-returning) to ask for the # of feet of wire for a room. The method should pass back the number of feet of wire. After calling the method, add the # of feet of wire to the total number of feet accumulator. Write a Display Results method (void method) that accepts the number of rooms, the total feet of wire, and the price per foot. It should add 10% (to ensure there is enough) to the total feet of wire (totFeet * 1.10 OR totFeet + totFeet * .10). The method will calculate the cost of the wire and then display the total feet of wire to purchase, and the cost. We'll do something similar to this in Chapter 7 using Arrays.

Sample output

(Rm1-20 ft, Rm2-30 ft, & Rm3-40 ft): 90 feet of wire is required 9.00 feet was added to prevent a shortage The total of 99.00 feet of wire at $4.50 Will cost $445.50 for the 3 rooms.

Hints/Tips

You can use either JOptionPane or Scanner. I use a for loop and sent the index to the Room Estimate method so I could ask for the feet for room 1 or 2 or 3 (since this is zero-based, you must add 1 if you do this) Since I had all the information, I made my message more informative, a good trait for a good programmer.

Rubric

Must create the two methods mentioned -50% per method Must get the number of feet of wire in a method and pass it back to the main method -25% The Display Results method must correctly calculate the cost of the wire with 10% added in to prevent a shortage -25% Must display the message with the total feet of wire and the cost -25% Code not formatted/indented properly -2%

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Quantitative Methods For Business

Authors: David Anderson, Dennis Sweeney, Thomas Williams, Jeffrey Cam

11th Edition

978-0324651812, 324651813, 978-0324651751

More Books

Students also viewed these Programming questions

Question

Why do workers sometimes resent time studies?

Answered: 1 week ago