Question: Use variables to name, store, and retrieve values Use System.out.print to prompt the user for input Use a Scanner to collect user input Use math

Use variables to name, store, and retrieve values
Use System.out.print to prompt the user for input
Use a Scanner to collect user input
Use math operators to construct expression
Use explicit cast operation or Math methods to round values
Output to console with System.out.printf
UseRosie'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 - things like stoplights, and 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).
Other Details
There is one intersection for every mile of road
Each intersection has two stoplights, plus one additional stoplight for each lane
Stoplights cost $25,000 per light
You must write a program that will collect, as input from the user, the number of miles of road (as a double), and the number of lanes this road will have (as an int). Your program must compute and store the following values: number of intersections (an int), number of stoplights needed (as an int), and total cost of the stoplights (as a double). Your program must then output these computed values a.
Example 1
Enter the number of miles of road : 3.0
Enter the number of lanes on this road : 2
Number of intersections : 3
Number of stoplights : 12
Cost of stoplights : $300000.00
Example 2
Enter the number of miles of road : 4.59
Enter the number of lanes on this road : 3
Number of intersections : 4
Number of stoplights : 20
Cost of stoplights : $500000.00
hint:
There is one intersection for every mile of road
a 1 mile mile road has 1 intersection
a 2 mile road has 2 intersections
a 2.99 mile road has 2 intersections
Each intersection has two stoplights, plus one additional stoplight for each lane
a 1 lane road has 3 stoplights at each intersection
a 2 lane road has 4 stoplights at each intersection
a 5 lane road has 7 stoplights at each intersection

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!