Travel on roads is a common activity. A few simple formulas can be used to help travelers plan their trips and avoid issues on the road.
I-15 is a North/South interstate highway with 400 miles of road in the state of Utah. There are mile markers every mile along the road starting with 0 in the Southwestern corner of the state, and ending near 400 on the Northern border of the state. Exits/on-ramps from/to the highway are numbered based on nearby mile markers. For example, the exit/on-ramp that connects to St. George Blvd. is numbered 8. Much of the stretch of I-15 in Utah has an upper speed limit of 80 miles per hour. Some areas have speed limits of 75 MPH or 65 MPH, depending on the road. Traveling too fast or too slow on the highway is dangerous to yourself and other travelers.
The distance between 2 exits can be calculated by subtraction. Just be sure to check which exit number is largest to make sure the distance is positive.
Travel time for a distance can be calculated by distance divided by speed.
This is where the Assignment instructions begin!
Write a program that asks the user for the locations of the on-ramp and exit they plan to use on the highway. It also needs to ask for how many hours until the traveler needs to arrive at their destination, and an expected average speed.
The program will calculate the distance to travel and the expected travel time, given the expected average speed.
Finally, the program will give one piece of advice, using this strategy:
- if the expected average speed is above 80 MPH, the user will be travelling dangerously (and breaking the law), warn them
- if the expected average speed is less than 60 MPH, the user will be causing problems on the highway, warn them
- if the travel time is larger than the time when the user wants to arrive, tell the user how late they will be
- if none of the above contiditions occur, tell the user how far they will travel, and how long they have to leave in order to be on time.
SIU. Dashboard CS1400: 1-15 Highway Travel Advisor Travel on roads is a common activity. A few simple formulas can be used to help travelers plan their trips and avoid issues on the road. 1-15 is a North/South Interstate highway with 400 miles of road in the state of Utah. There are mile markers every mile along the road starting with o in the Southwestern corner of the state, and ending near 400 on the Northern border of the state. Exits/on-ramps from/to the highway are numbered based on nearby mile markers. For example, the exit/on-ramp that connects to St. George Blvd. is numbered 8. Much of the stretch of I-15 in Utah has an upper speed limit of 80 miles per hour. Some areas have speed limits of 75 MPH or 65 MPH, depending on the road. Traveling too fast or too slow on the highway is dangerous to yourself and other travelers. The distance between 2 exits can be calculated by subtraction. Just be sure to check which exit number is largest to make sure the distance is positive. Travel time for a distance can be calculated by distance divided by speed. Assignment Write a program that asks the user for the locations of the on-ramp and exit they plan to use on the highway. It also needs to ask for how many hours until the traveler needs to arrive at their destination, and an expected average speed The program will calculate the distance to travel and the expected travel time, given the expected average speed. Finally, the program will give one piece of advice, using this strategy . If the expected average speed is above 80 MPH, the user will be travelling dangerously (and breaking the law), warn them . if the expected average speed is less than 60 MPH, the user will be causing problems on the highway, warn them . If the travel time is larger than the time when the user wants to arrive, tell the user how late they will be if none of the above contiditions occur, tell the user how far they will travel, and how long they have to leave in order to be on time. Washboard Potential Sessions Sample 1 Welcome to the highway travel advisor. This application has been configured to work with travel on 1-15 within the state of Utah. We'll ask for a few pieces of information, then give you advice on your travel Enter I-15 at what mile marker?.6 Exit 1-15 at what mile marker? 106 How many hours from now do you want to arrive? 4.5 Expected average speed in MPH2 75 You will travel: 300 miles Leave in the next 0.5 hours to be on time. Thanks for using the highway travel advisor. Sample 2 Welcome to the highway travel advisor. This application has been configured to work with travel on 1-15 within the state of Utah. We'll ask for a few pieces of information, then give you advice on your travel. Enter 1-15 at what mile marker? 6 Exit 1-15 at what mile saker? 306 How many hours from now do you want to arrive? 2.75 Expected average speed in MP7 75 You won't be able to get there on time. You'll be 1.25 hours late. Thanks for using the highway travel advisor. Sample 3 SIU. Dashboard CS1400: 1-15 Highway Travel Advisor Travel on roads is a common activity. A few simple formulas can be used to help travelers plan their trips and avoid issues on the road. 1-15 is a North/South Interstate highway with 400 miles of road in the state of Utah. There are mile markers every mile along the road starting with o in the Southwestern corner of the state, and ending near 400 on the Northern border of the state. Exits/on-ramps from/to the highway are numbered based on nearby mile markers. For example, the exit/on-ramp that connects to St. George Blvd. is numbered 8. Much of the stretch of I-15 in Utah has an upper speed limit of 80 miles per hour. Some areas have speed limits of 75 MPH or 65 MPH, depending on the road. Traveling too fast or too slow on the highway is dangerous to yourself and other travelers. The distance between 2 exits can be calculated by subtraction. Just be sure to check which exit number is largest to make sure the distance is positive. Travel time for a distance can be calculated by distance divided by speed. Assignment Write a program that asks the user for the locations of the on-ramp and exit they plan to use on the highway. It also needs to ask for how many hours until the traveler needs to arrive at their destination, and an expected average speed The program will calculate the distance to travel and the expected travel time, given the expected average speed. Finally, the program will give one piece of advice, using this strategy . If the expected average speed is above 80 MPH, the user will be travelling dangerously (and breaking the law), warn them . if the expected average speed is less than 60 MPH, the user will be causing problems on the highway, warn them . If the travel time is larger than the time when the user wants to arrive, tell the user how late they will be if none of the above contiditions occur, tell the user how far they will travel, and how long they have to leave in order to be on time. Washboard Potential Sessions Sample 1 Welcome to the highway travel advisor. This application has been configured to work with travel on 1-15 within the state of Utah. We'll ask for a few pieces of information, then give you advice on your travel Enter I-15 at what mile marker?.6 Exit 1-15 at what mile marker? 106 How many hours from now do you want to arrive? 4.5 Expected average speed in MPH2 75 You will travel: 300 miles Leave in the next 0.5 hours to be on time. Thanks for using the highway travel advisor. Sample 2 Welcome to the highway travel advisor. This application has been configured to work with travel on 1-15 within the state of Utah. We'll ask for a few pieces of information, then give you advice on your travel. Enter 1-15 at what mile marker? 6 Exit 1-15 at what mile saker? 306 How many hours from now do you want to arrive? 2.75 Expected average speed in MP7 75 You won't be able to get there on time. You'll be 1.25 hours late. Thanks for using the highway travel advisor. Sample 3