Computers and Technology
7.24 Worked Example - Rosie's Road Co. - Full Program Required Skills Inventory Construct a program with multiple methods Declare a variable Instantiate an object Use Scanner nextInt or nextDouble method to collect user input Output to console with System.out.print, System.out.println, and System.out.printf Call a method from inside the body of another method Capture and store the values returned from a method call Use math methods to construct an expression Problem Description and Given Info Rosie's Road Co. is a new local construction company. They are interested in bidding on new highway construction projects around the city. They've hired you to develop some software tools that they will use to help determine material needs and costs. Road development is not only the asphalt you see - water and power conduits must be installed at the same time, and we have to account for things like labor costs and how long it will take to develop a particular project. The city is very regular grid, with one 4-way intersection at each mile of road. When asking for a quote, the city sends out the number of linear miles of road, and how many total lanes (1 to 8). 1. The trucks hauling asphalt have a maximum capacity of 5 US tons (10,000 lbs) 2. The standard road lane is 12 feet wide. 3. Asphalt weighs 150 lbs per cubic foot 4. Asphalt costs $250 per ton 5. Power and water utilities are run under the road as part of all road projects 6. Power conduit is available only in 20 ft. lengths - each length costs $350 7. Water main pipe is available only in 15 ft. lengths - each length costs $280 8. There is one intersection for every mile of road 9. Stoplights cost $32,000 per light (look it up, that's real!) 10. Each intersection has two stoplights, plus one additional stoplight for each lane 11. Work days are 8-hour days 12. All workers are paid $24 per hour. 13. Crew members can complete an amount of work in a specified time according to the equation and table below: crew_members = (50 * miles_of_road * number_of_lanes) / days_to_complete Crew Members Miles Lanes Days to Complete 1 1 1 50 1 1 2 100 1 2 1 100 1 2 2 200 2 1 1 25 2. 1 2 50 2 2 1 50 2 2. 2 100 Part 5 - Full Program Design and construct a complete program for Rosie's Road Co. Use the methods that have already been created to compute the required values. Be sure to carefully review the code that you are give. This code already include several methods that should be very helpful in solving this problem. Your program should take as input from the user, the following in this order). 1. Length of road project in miles (double) 2. Number of lanes (int) 3. Depth of asphalt in inches (int) 4. Days to complete project (int) Your program should display a nicely formatted report with the following information - each on a separate line. 1. Amount of materials needed o Truckloads of Asphalt o Stoplights o Water pipes o Power pipes 2. Number of crew members needed 3. Total cost of: o Asphalt (U.S.tons) Stoplights o Water pipes o Power pipes o Labor 4. Total cost of project Here is an example of what your program should look like when it runs: Enter Road Project Length in Miles : 2.75 Enter Number of Lanes : 3 Enter Depth of Asphalt in Inches : 12 Enter Days to Complete Project : 30 : == Amount of Materials Needed === Truckloads of Asphalt : 7841 Stoplights : 10 Water pipes : 968 Power pipes : 726 Crew members needed 14 === Cost of Materials Cost of Asphalt : $9801250.00 Cost of Stoplights : $320000.00 Cost of Water pipes : $271040.00 Cost of Power pipes : $ 254100.00 Cost of Labor : $80640.00 === Total cost of Project Total cost of project : $10727030.00 ====