Answered step by step
Verified Expert Solution
Question
1 Approved Answer
It is very important to know how long it would take you to safely stop your car in the event of an emergency (like
It is very important to know how long it would take you to safely stop your car in the event of an emergency (like a car pulling out in front of you in traffic). In this assignment, you will use loops to create a (very simplified) visualization of this process. You will prompt the user to enter three key pieces of information 1. How fast their car is currently moving (in miles per hour) 2. How quickly can you decelerate (in miles)? o As this is not a physics class, we will assume you can directly subtract this value from your speed every second. 3. The time interval you want to see speed updates on (in seconds) You will then use a loop to calculate how far you have traveled each second as you decelerate. You will display the current speed and distance at the time internal the user specified using a looping structure. When you reach 0, stop the loop and print the final results. Call the file Assignment4A (.java, .cs, .cpp) and the class name Assignment4A. User input is indicated in bold. Sample Output #1: [Stopping Time] How fast are you going (miles/hour)? 5 How quickly can you decelerate (miles)? 1 How often do you want to see updates (in seconds)? 1 You are going 5 MPH when you slam on the brakes! At 1 second, you have traveled 7.3335 feet and are now moving at 4 MPH. At 2 seconds, you have traveled 13.2003 feet and are now moving at 3 MPH. At 3 seconds, you have traveled 17.6004 feet and are now moving at 2 MPH. At 4 seconds, you have traveled 20.5338 feet and are now moving at 1 MPII. At 5 seconds, you have traveled 22.0005 feet and are now moving at 0 MPH. You took 5 seconds to stop and traveled 22.005 feet during that time! It is very important to know how long it would take you to safely stop your car in the event of an emergency (like a car pulling out in front of you in traffic). In this assignment, you will use loops to create a (very simplified) visualization of this process. You will prompt the user to enter three key pieces of information 1. How fast their car is currently moving (in miles per hour) 2. How quickly can you decelerate (in miles)? o As this is not a physics class, we will assume you can directly subtract this value from your speed every second. 3. The time interval you want to see speed updates on (in seconds) You will then use a loop to calculate how far you have traveled each second as you decelerate. You will display the current speed and distance at the time internal the user specified using a looping structure. When you reach 0, stop the loop and print the final results. Call the file Assignment4A (.java, .cs, .cpp) and the class name Assignment4A. User input is indicated in bold. Sample Output #1: [Stopping Time] How fast are you going (miles/hour)? 5 How quickly can you decelerate (miles)? 1 How often do you want to see updates (in seconds)? 1 You are going 5 MPH when you slam on the brakes! At 1 second, you have traveled 7.3335 feet and are now moving at 4 MPH. At 2 seconds, you have traveled 13.2003 feet and are now moving at 3 MPH. At 3 seconds, you have traveled 17.6004 feet and are now moving at 2 MPH. At 4 seconds, you have traveled 20.5338 feet and are now moving at 1 MPII. At 5 seconds, you have traveled 22.0005 feet and are now moving at 0 MPH. You took 5 seconds to stop and traveled 22.005 feet during that time!
Step by Step Solution
★★★★★
3.43 Rating (156 Votes )
There are 3 Steps involved in it
Step: 1
It seems like you need a program that calculates and displays the deceleration of a car when the use...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started