Answer:
Algorithm:
ValidateCarData (milesDrives, age)
Start
- Prompt the user to enter the number of miles and the age of a car.
- Get the input from the user.
- Store the number of drives in the variable named milesDrives and the age of the car in the variable named age.
- if ( milesDrives < 10000 and age <= 5)
Display true.
Display false.
Stop
Step-by-step explanation:
Algorithm: An algorithm is a step-by-step solution to a problem in a finite number of steps.
A car dealer sells only the car that
- drives less than 10000 miles
- and the age of the car is equal to or less than 5 years.
Prompt the user to enter the number of miles and the age of a car.
Validate the user-entered data.
when the user-entered data is valid (car drive fewer than 10000 miles and 5 years or less old)
Display true (user enters the valid data).
else (car drives more than 10000 miles or more than 5 years old)
Display false (user enters the invalid data).