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 11:30
Write a function so that the main program below can be replaced by the simpler code that calls function original main program: miles_per_hour = float( minutes_traveled = float( hours_traveled = minutes_traveled / 60.0 miles_traveled = hours_traveled * miles_per_hour print('miles: %f' % miles_traveled) sample output with inputs: 70.0 100.0 miles: 116.666667
Answers: 3
question
Computers and Technology, 22.06.2019 23:30
What are listed in the vertical columns across the top of the event editor? a. file names b. conditions c. check marks d. action types
Answers: 1
question
Computers and Technology, 23.06.2019 00:30
Knowing that the central portion of link bd has a uniform cross sectional area of 800 mm2 , determine the magnitude of the load p for which the normal stress in link bd is 50 mpa. (hint: link bd is a two-force member.) ans: p = 62.7 kn
Answers: 2
question
Computers and Technology, 23.06.2019 09:30
You have been supporting csm tech publishing's windows server 2016 server network for over a year. the office has two windows server 2016 servers running active directory and a number of other roles. management has informed you that a small sales office is opening in the same building three floors up. the sales manager wants to install a sales application on a server located in the sales office. this server will have limited physical security because there's no special room dedicated for it, which means it will be accessible to non-it personnel and visitors. you're considering installing windows server 2016 server core on the new server because accessing its console regularly probably won't be necessary, and this server will be managed from one of the other csm tech publishing servers. what are the benefits and drawbacks of using server core for this branch office? what are some things you should do to set up this server management environment?
Answers: 1
You know the right answer?
Convert MPG Algorithm to C++ code. Activity:
1. Understand the MPG Algorithm posted in this...
Questions
question
History, 05.02.2021 01:00
question
Physics, 05.02.2021 01:00
question
History, 05.02.2021 01:00
Questions on the website: 13722363