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 18:30
Which of these options are the correct sequence of actions for content to be copied and pasted? select content, click the copy button, click the paste button, and move the insertion point to where the content needs to be inserted. click the copy button, select the content, move the insertion point to where the content needs to be inserted, and click the paste button. select the content, click the copy button, move the insertion point to where the content needs to be inserted, and click the paste button. select the content, move the insertion point to where the content needs to be inserted, click the copy button, and click the paste button.
Answers: 3
question
Computers and Technology, 23.06.2019 03:30
Hashtags serve to identify the topic of a given tweet true false
Answers: 2
question
Computers and Technology, 24.06.2019 05:30
How do i get rid of my member ship for
Answers: 2
question
Computers and Technology, 24.06.2019 08:30
Formatting rows and columns is similar to cell formatting. in an openoffice calc spreadsheet, you can format data entered into rows and columns with the of the rows and columns options. you can insert rows and columns into, or delete rows and columns from, a spreadsheet. use the insert or delete rows and columns option on the insert tab. alternatively, select the row or column where you want new rows or columns to appear, right-click, and select insert only row or only column options. you can hide or show rows and columns in a spreadsheet. use the hide or show option on the format tab. for example, to hide a row, first select the row, then choose the insert tab, then select the row option, and then select hide. alternatively, you can select the row or columns, right-click, and select the hide or show option. you can adjust the height of rows and width of columns. select row and then select the height option on the format tab. similarly, select column, then select the width option on the format tab. alternatively, you can hold the mouse on the row and column divider, and drag the double arrow to the position. you can also use the autofit option on the table tab to resize rows and columns.
Answers: 1
You know the right answer?
Convert MPG Algorithm to C++ code. Activity:
1. Understand the MPG Algorithm posted in this...
Questions
question
Mathematics, 21.05.2020 07:57
question
Mathematics, 21.05.2020 07:57
question
Mathematics, 21.05.2020 07:57
Questions on the website: 13722367