Question
one example Description : Assuming there are no accidents or delays, the distance that a car travels down the interstate can be calculated with the
one example
Description: Assuming there are no accidents or delays, the distance that a car travels down the interstate can be calculated with the following formula:
Distance = Speed x Time
Prompt the user for the speed the car is traveling and calculate the distance traveled for 5, 8 and 12 hours. The output should be in the form of
The distance the car will travel in 5 hours is xxx
The xxx is the calculated miles traveled.
Initial Algorithm:
Declare variables
Get the speed
Calculate distance for 5 hours
Calculate distance for 8 hours
Data Requirements:(I/O)
Input speed
Output distance5
Output distance 8
Formulas: Distance = Speed x Time
Refined Algorithm
Declare Constant int TIME_5 = 5
Declare Constant int TIME_8 = 8
Refined Algorithm
Declare Constant int TIME_5 = 5
Declare Constant int TIME_8 = 8
Declare Constant int TIME_12 = 12
Declare float speed
Declare float distance5
Declare float distance8
Declare float distance12
Display Please enter the speed
Input speed
Write a program that computes and displays the discount price of an item. The user will enter the price of the item and the amount of the discount as a percent Initial Algorithm: Data Requirements Formulas: Refined Algorithm
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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