subject

Convert MPG Algorithm to C++ code. Activity:
1. Understand the MPG Algorithm posted in this activity.
2. Determine the condition for terminating the loop.
3. Which step will cause infinite loop if we took it out.
4. Implement provided algorithm in C++ code
5. Define possible sample inputs and output (test cases) to cover each steps in this algorithm (For example, you need to have two different input sets in order to have Step 8 and 9 both covered.
6. Enhance the algorithm and write code to calculate the accumulated mpg from multiple trips.
Reference:
Step Operation
1 response = Yes
2 While (response = Yes) do Steps 3 through 11
3 Get values for gallons used, starting mileage, ending mileage
4 Set value of distance driven to (ending mileage - starting mileage)
5 Set value of average miles per gallon to (distance driven = gallons used)
6 Print the value of average miles per gallon
7 If average miles per gallon > 25.0 then
8 Print the message 'You are getting good gas mileage
Else
9 Print the message You are NOT getting good gas mileage'
10 Print the message 'Do you want to do this again? Enter Yes or No'
11 Get a new value for response from the user
12 Stop
Submit the Discussion Response with code and execution result.
Part 2. Analyzes each sentence and state your reasoning on applicability to your lab assignments (150 words) and example to support the statement below:
1. Functions break large computing tasks into smaller ones and enable people to build on what others have done instead of starting over from scratch.
2. Appropriate functions hide details of operation from parts of the program that don’t need to know them, thus clarifying the whole, and easing the pain of making changes "

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 17:30
The forerunner to cell phones, pdas, and smartphones was
Answers: 1
question
Computers and Technology, 23.06.2019 15:00
1. which of the following statements are true about routers and routing on the internet. choose two answers. a. protocols ensure that a single path between two computers is established before sending packets over it. b. routers are hierarchical and the "root" router is responsible for communicating to sub-routers the best paths for them to route internet traffic. c. a packet traveling between two computers on the internet may be rerouted many times along the way or even lost or "dropped". d. routers act independently and route packets as they see fit.
Answers: 2
question
Computers and Technology, 24.06.2019 11:20
Colby works as a shipping clerk for a major package delivery service. some of his daily tasks include tracking shipments and entering orders. which aspect of the information technology cluster would he most likely be trained in? a.networkingb.databasesc.hardwared.software
Answers: 2
question
Computers and Technology, 24.06.2019 23:40
Which slide should you change so it reflects om all sides of your presentation
Answers: 1
You know the right answer?
Convert MPG Algorithm to C++ code. Activity:
1. Understand the MPG Algorithm posted in this...
Questions
question
Spanish, 06.05.2020 08:12
question
Mathematics, 06.05.2020 08:12
question
Mathematics, 06.05.2020 08:12
question
Mathematics, 06.05.2020 08:12
question
Mathematics, 06.05.2020 08:12
Questions on the website: 13722359