The distance a vehicle travels can be calculated as follows: distance = speed * time For...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
The distance a vehicle travels can be calculated as follows: distance = speed * time For example, if a train travels 40 miles per hour for three hours, the distance traveled is 120 miles. Write a program that askes the user to enter the speed of a vehicle and the number of hours it has traveled. It should then use a loop to display the distance the vehicle has traveled for each hour of that time period. It then shows the accumulated distance at the end. Here is an example of the desired output: Enter the speed of the vehicle in mph: 45 Enter the number of hours traveled: 6 Hour Distance Traveled 1 2 3 4 5 56 45.0 90.0 135.0 180.0 225.0 270.0 6 The accumalated distance travaled is: 945.0 mp 5. The distance a vehicle travels can be calculated as follows: distance = speed * time For example, if a train travels 40 miles per hour for three hours, the distance traveled is 120 miles. Write a program that askes the user to enter the speed of a vehicle and the number of hours it has traveled. It should then use a loop to display the distance the vehicle has traveled for each hour of that time period. It then shows the accumulated distance at the end. Here is an example of the desired output: Enter the speed of the vehicle in mph: 45 Enter the number of hours traveled: 6 Hour Distance Traveled 1 2 3 4 5 56 45.0 90.0 135.0 180.0 225.0 270.0 6 The accumalated distance travaled is: 945.0 mp 5.
Expert Answer:
Answer rating: 100% (QA)
Heres a Python program that does what described in question Get the speed of the vehicle from the user speed floatinputEnter the speed of the vehicle in mph Get the number of hours traveled from the u... View the full answer
Related Book For
Starting Out With Java From Control Structures Through Data Structures
ISBN: 9780133957051
6th Edition
Authors: Tony Gaddis
Posted Date:
Students also viewed these programming questions
-
Due to erratic sales of its sole producta high-capacity battery for laptop computersPEM, Incorporated, has been experiencing financial difficulty for some time. The company's contribution format...
-
The distance a vehicle travels can be calculated as follows: Distance = Speed * Time For example, if a train travels 40 miles-per-hour for three hours, the distance traveled is 120 miles. Write a...
-
Two-dimensional array operations: Movie Ratings program ** You have recently collected reviews from four movie reviewers where the reviewers are numbered 1-4. Each reviewer has rated six movies where...
-
Which one the below does not define "Work role boundaries" of a care worker limits that allow a patient and staff to connect safely in a therapeutic relationship based on patients' needs rules of...
-
On October 1, 2018, Modern Company purchased a patent for $153,600 cash. Although the patent gives legal protection for 20 years, the patent is expected to be used for only eight years. Requirements...
-
Solve the system in Problem 26A by writing the system as a matrix equation and using the inverse of the coefficient matrix (see Problem 25). Also, solve the system if the constants 1, 3, and 3 are...
-
Micaela works for a sprinkler maintenance company and runs a routine check on the Harris's sprinkler system every third month. If Micaela checks the system in an April, what month will it be when...
-
Bea Jones (age 32) moved from Texas to Florida in December 2013. She lives at 654 Ocean Way, Gulfport, FL 33707. Beas Social Security number is 466787359 and she is single. Her earnings and income...
-
XYZ stock price and dividend history are as follows: Year Beginning-of-Year Price Dividend Paid at Year-End 2018 $ 138 $ 5 2019 156 5 2020 130 5 2021 135 5 An investor buys five shares of XYZ ...
-
Repeat Example 9.2, but with a feed pressure of 5.0 MPa. Compare your results to those obtained at a feed pressure of 1.0 \(\mathrm{MPa}\). Data From Example 9.2:- Air can be separated into...
-
TechCom had credit sales of $300,000 during its first year of operations. At the end of the first year, $20,000 of credit sales remained uncollected. Based on the experience of similar businesses,...
-
If a normal population has a mean of and a standard deviation of , then the area to the left of is less than 0.5. In Exercises 1116, determine whether the statement is true or false. If the...
-
Related parties are generally cited as indicators of a higher risk of fraud existing for an auditee. The idea is that arms-length transactions in and of themselves exercise control over the propriety...
-
How do exponential smoothing techniques differ from unweighted moving-average techniques?
-
A z-score indicates how many standard deviations a value is above or below the mean. In Exercises 1116, determine whether the statement is true or false. If the statement is false, rewrite it as a...
-
Consider two independent, identically distributed random variables \(\Theta_{1}\) and \(\Theta_{2}\), each of which obeys a probability density function \[ p_{\Theta}(\theta)=\left\{\begin{array}{cc}...
-
Calculate f, the proportion of applicants perceived as female who received callbacks. Round your answer to four places past the decimal. the 3,746 applications with names perceived as female, 309...
-
On January 1, 2017, McIlroy, Inc., acquired a 60 percent interest in the common stock of Stinson, Inc., for $340,200. Stinson's book value on that date consisted of common stock of $100,000 and...
-
True or False: When a method is declared with the final modifier, it must be overridden in a subclass.
-
Look at the following SQL statement. SELECT Id FROM Account What is the name of the table from which this statement is retrieving data? What is the name of the column that is being retrieved?
-
Whats wrong with the following array declarations? Int[] readings = new int[-1]; Double[] measurements = new double[4.5];
-
Banks advertise to attract customers.
-
Discuss how you benefit when interest is compounded monthly as opposed to annually.
-
Identify the services offered by the different financial institutions.
Study smarter with the SolutionInn App