Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Section 3 -- Loops and Conditional statements 6 points (1 pt) Input two values from the keyboard: The length of a car trip in kilometres,

image text in transcribed

Section 3 -- Loops and Conditional statements 6 points (1 pt) Input two values from the keyboard: The length of a car trip in kilometres, between 1 and 500; The duration of this car trip in hours, between 1 and 10. (1 pt) Then, calculate and print the average speed at which the user would have to drive to cover this distance in the time allotted. For now, you are free to assume that the user is indeed typing numbers within the appropriate ranges. You are free to treat these values as integers or as floating-point numbers, whichever you prefer. (2 pts) Give the user feedback on their plan for their trip: If the average speed is greater than 100 km/h, inform the user that they would have to drive past the speed limit. If it is less than 65 km/h, inform them that they should not drive on the highway. Otherwise, wish them a nice trip. (2 pts) Once the program above works, modify it to check that what the user has entered is indeed numbers within the appropriate ranges. You will probably want to use while loops and conditional statements to implement these checks. In [ ]: N

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

An IP address is made up of four 8 - bit integers.

Answered: 1 week ago