Sam is thinking about driving from his town to another location by car, but he is unsure how much time he should allow based on the distance and speed. It is important to note that some routes use miles while others use kilometers. To assist Sam, you can use the formula: Time = Distance/Speed and provide him with the time in minutes. Write a C++ program that prompts Sam to enter the distance in either Miles or Kilometers followed by the average speed in kilometers/minute. If Sam enters the distance in Miles, you should convert it to Kilometers, with 1 mile equaling 1.6 kilometers. Your program should accept only positive numbers for distance and speed values. Once you have found the time, you should check the safety of the car systems by asking four questions: What is the Oil level on the dipstick, enter 0 for below minimum, 1 for between minimum and maximum and 2 above maximum? Is the front and rear Tires Pressures between 30 and 35? Answer Yes or No Is the engine temperature warning light ON? Answer Yes or No Is the Battery Alert light ON? Answer Yes or No First, print the time and the speed with the distance in three decimal places. Then, based on Sam's answers, display the safety actions. If Sam answers 1 for question 1, “Yes” for question 2 and "No" to all other questions, show a message that reflects this. However, if Sam answers 0 or 2 for the first question, “No” for the second question or "Yes" to any other questions, display a formatted table showing the corresponding action Sam should take. Refer to the table below for the appropriate action for each safety question.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
  1. Sam is thinking about driving from his town to another location by car, but he is unsure how much time he should allow based on the distance and speed. It is important to note that some routes use miles while others use kilometers. To assist Sam, you can use the formula: Time = Distance/Speed and provide him with the time in minutes.

    Write a C++ program that prompts Sam to enter the distance in either Miles or Kilometers followed by the average speed in kilometers/minute. If Sam enters the distance in Miles, you should convert it to Kilometers, with 1 mile equaling 1.6 kilometers. Your program should accept only positive numbers for distance and speed values. Once you have found the time, you should check the safety of the car systems by asking four questions:

    1. What is the Oil level on the dipstick, enter 0 for below minimum, 1 for between minimum and maximum and 2 above maximum?

    2. Is the front and rear Tires Pressures between 30 and 35? Answer Yes or No

    3. Is the engine temperature warning light ON? Answer Yes or No

    4. Is the Battery Alert light ON? Answer Yes or No

    First, print the time and the speed with the distance in three decimal places. Then, based on Sam's answers, display the safety actions. If Sam answers 1 for question 1, “Yes” for question 2 and "No" to all other questions, show a message that reflects this. However, if Sam answers 0 or 2 for the first question, “No” for the second question or "Yes" to any other questions, display a formatted table showing the

corresponding action Sam should take. Refer to the table below for the appropriate action for each safety question.

 

Cause:

Oil level below minimum

Oil level above maximum

Tires Pressures is not between 30 and 35

Engine temperature warning light ON

Battery Alert light ON

Action:

You should add oil as needed and inspect for any potential oil leaks.

You should visit a repair shop to drain the excess oil

Check the tire pressure and adjust it as needed by inflating or deflating the tires.

Call a roadside service to tow your car to a repair shop.

You should visit a repair shop to have your electrical system checked for faults. A new battery may be necessary.

 

 

 

Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Algebraic Expressions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education