SlideShare a Scribd company logo
1) Drivers are concerned with the mileage obtained by their cars. One driver has kept track
of several tankful of gasoline by recording miles driven and gallons used for each tankful.
Develop a c++ program that uses a while statement to input the miles driven and gallons
used for each tankful. The program should calculate and display the miles per gallon
obtained for each tankful and print the combined miles per gallon obtained for all tankfuls up
to that point. If the mileage is -1, the program quits.
Sample Output:
Enter Mileage for Trip #1 : 200
Enter Gallons for Trip #1 : 10
MPG for Trip #1 : 20
MPG for all trips so far is 20
Enter Mileage for Trip #2 : 300
Enter Gallons for Trip #2 : 20
MPG for Trip #2 : 15
MPG for all trips so far is 16.6667
Enter Mileage for Trip #3 : -1
Thank you for using our MPG program!

More Related Content

Similar to 1) Drivers are concerned with the mileage obtained by their cars. One driver has kept track of sev

2013.6.9 doctor research
2013.6.9 doctor research2013.6.9 doctor research
2013.6.9 doctor research
Vinidya Pratama
 
2013.6.9 doctor research
2013.6.9 doctor research2013.6.9 doctor research
2013.6.9 doctor research
Vinidya Pratama
 
Cargobill: System for Freight cost calculations
Cargobill: System for Freight cost calculationsCargobill: System for Freight cost calculations
Cargobill: System for Freight cost calculations
NELSON SALDIAS SEGUEL
 
Evsa sales deck [pub]
Evsa sales deck [pub]Evsa sales deck [pub]
Evsa sales deck [pub]
Jorge Sánchez Ureña
 
Ways to control carbon emission from fleets
Ways to control carbon emission from fleetsWays to control carbon emission from fleets
Ways to control carbon emission from fleets
Tracko.co.in
 
Monitoring co2 emissions from new passenger cars in the eu
Monitoring co2 emissions from new passenger cars in the euMonitoring co2 emissions from new passenger cars in the eu
Monitoring co2 emissions from new passenger cars in the eu
Autoblog.it
 
Nhtsa epa hd nprm dec 16 webinar b
Nhtsa epa hd nprm   dec 16 webinar bNhtsa epa hd nprm   dec 16 webinar b
Nhtsa epa hd nprm dec 16 webinar b
CALSTART
 
Diesel Field Study Stop and Go
Diesel Field Study Stop and GoDiesel Field Study Stop and Go
Diesel Field Study Stop and Go
Matt Smith
 
Calculating-volume-GHG-emissions-saved-from-reduction-in-kilometers-driven-by...
Calculating-volume-GHG-emissions-saved-from-reduction-in-kilometers-driven-by...Calculating-volume-GHG-emissions-saved-from-reduction-in-kilometers-driven-by...
Calculating-volume-GHG-emissions-saved-from-reduction-in-kilometers-driven-by...
Juli Mohammad
 
Leeds City C Ppt For Presentation
Leeds City C Ppt For PresentationLeeds City C Ppt For Presentation
Leeds City C Ppt For Presentation
Dr David Clayton
 
Fiscal instruments: incentives for auto fuel economy improvement.Vicente Fran...
Fiscal instruments: incentives for auto fuel economy improvement.Vicente Fran...Fiscal instruments: incentives for auto fuel economy improvement.Vicente Fran...
Fiscal instruments: incentives for auto fuel economy improvement.Vicente Fran...
undprussia
 
Predicting Vehicle Fuel Consumption & Emissions
Predicting Vehicle Fuel Consumption & EmissionsPredicting Vehicle Fuel Consumption & Emissions
Predicting Vehicle Fuel Consumption & Emissions
SGS
 
Fuel control in fleet management
Fuel control in fleet managementFuel control in fleet management
Fuel control in fleet management
Tristan Wiggill
 
Industry solution presentation “Diesel generator monitoring"
Industry solution presentation “Diesel generator monitoring"Industry solution presentation “Diesel generator monitoring"
Industry solution presentation “Diesel generator monitoring"
Technoton
 
BMW budget guide march 2018
BMW budget guide march 2018BMW budget guide march 2018
BMW budget guide march 2018
Andrew Clark
 
TOTAL FLEET MANAGEMENT
TOTAL FLEET MANAGEMENTTOTAL FLEET MANAGEMENT
TOTAL FLEET MANAGEMENT
Mikel Aguirre Claramunt
 
EaP GREEN: Overview of the use of environmentally-related product taxes in OE...
EaP GREEN: Overview of the use of environmentally-related product taxes in OE...EaP GREEN: Overview of the use of environmentally-related product taxes in OE...
EaP GREEN: Overview of the use of environmentally-related product taxes in OE...
OECD Environment
 
Arai emission testing
Arai emission testingArai emission testing
Arai emission testing
mangal108
 

Similar to 1) Drivers are concerned with the mileage obtained by their cars. One driver has kept track of sev (18)

2013.6.9 doctor research
2013.6.9 doctor research2013.6.9 doctor research
2013.6.9 doctor research
 
2013.6.9 doctor research
2013.6.9 doctor research2013.6.9 doctor research
2013.6.9 doctor research
 
Cargobill: System for Freight cost calculations
Cargobill: System for Freight cost calculationsCargobill: System for Freight cost calculations
Cargobill: System for Freight cost calculations
 
Evsa sales deck [pub]
Evsa sales deck [pub]Evsa sales deck [pub]
Evsa sales deck [pub]
 
Ways to control carbon emission from fleets
Ways to control carbon emission from fleetsWays to control carbon emission from fleets
Ways to control carbon emission from fleets
 
Monitoring co2 emissions from new passenger cars in the eu
Monitoring co2 emissions from new passenger cars in the euMonitoring co2 emissions from new passenger cars in the eu
Monitoring co2 emissions from new passenger cars in the eu
 
Nhtsa epa hd nprm dec 16 webinar b
Nhtsa epa hd nprm   dec 16 webinar bNhtsa epa hd nprm   dec 16 webinar b
Nhtsa epa hd nprm dec 16 webinar b
 
Diesel Field Study Stop and Go
Diesel Field Study Stop and GoDiesel Field Study Stop and Go
Diesel Field Study Stop and Go
 
Calculating-volume-GHG-emissions-saved-from-reduction-in-kilometers-driven-by...
Calculating-volume-GHG-emissions-saved-from-reduction-in-kilometers-driven-by...Calculating-volume-GHG-emissions-saved-from-reduction-in-kilometers-driven-by...
Calculating-volume-GHG-emissions-saved-from-reduction-in-kilometers-driven-by...
 
Leeds City C Ppt For Presentation
Leeds City C Ppt For PresentationLeeds City C Ppt For Presentation
Leeds City C Ppt For Presentation
 
Fiscal instruments: incentives for auto fuel economy improvement.Vicente Fran...
Fiscal instruments: incentives for auto fuel economy improvement.Vicente Fran...Fiscal instruments: incentives for auto fuel economy improvement.Vicente Fran...
Fiscal instruments: incentives for auto fuel economy improvement.Vicente Fran...
 
Predicting Vehicle Fuel Consumption & Emissions
Predicting Vehicle Fuel Consumption & EmissionsPredicting Vehicle Fuel Consumption & Emissions
Predicting Vehicle Fuel Consumption & Emissions
 
Fuel control in fleet management
Fuel control in fleet managementFuel control in fleet management
Fuel control in fleet management
 
Industry solution presentation “Diesel generator monitoring"
Industry solution presentation “Diesel generator monitoring"Industry solution presentation “Diesel generator monitoring"
Industry solution presentation “Diesel generator monitoring"
 
BMW budget guide march 2018
BMW budget guide march 2018BMW budget guide march 2018
BMW budget guide march 2018
 
TOTAL FLEET MANAGEMENT
TOTAL FLEET MANAGEMENTTOTAL FLEET MANAGEMENT
TOTAL FLEET MANAGEMENT
 
EaP GREEN: Overview of the use of environmentally-related product taxes in OE...
EaP GREEN: Overview of the use of environmentally-related product taxes in OE...EaP GREEN: Overview of the use of environmentally-related product taxes in OE...
EaP GREEN: Overview of the use of environmentally-related product taxes in OE...
 
Arai emission testing
Arai emission testingArai emission testing
Arai emission testing
 

Recently uploaded

HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
deepaannamalai16
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
iammrhaywood
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
HajraNaeem15
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
imrankhan141184
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
RAHUL
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
Himanshu Rai
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
MysoreMuleSoftMeetup
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
TechSoup
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...
PsychoTech Services
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.pptLevel 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Henry Hollis
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
Bonku-Babus-Friend by Sathyajith Ray (9)
Bonku-Babus-Friend by Sathyajith Ray  (9)Bonku-Babus-Friend by Sathyajith Ray  (9)
Bonku-Babus-Friend by Sathyajith Ray (9)
nitinpv4ai
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 

Recently uploaded (20)

HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.pptLevel 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
Bonku-Babus-Friend by Sathyajith Ray (9)
Bonku-Babus-Friend by Sathyajith Ray  (9)Bonku-Babus-Friend by Sathyajith Ray  (9)
Bonku-Babus-Friend by Sathyajith Ray (9)
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 

1) Drivers are concerned with the mileage obtained by their cars. One driver has kept track of sev

  • 1. 1) Drivers are concerned with the mileage obtained by their cars. One driver has kept track of several tankful of gasoline by recording miles driven and gallons used for each tankful. Develop a c++ program that uses a while statement to input the miles driven and gallons used for each tankful. The program should calculate and display the miles per gallon obtained for each tankful and print the combined miles per gallon obtained for all tankfuls up to that point. If the mileage is -1, the program quits. Sample Output: Enter Mileage for Trip #1 : 200 Enter Gallons for Trip #1 : 10 MPG for Trip #1 : 20 MPG for all trips so far is 20 Enter Mileage for Trip #2 : 300 Enter Gallons for Trip #2 : 20 MPG for Trip #2 : 15 MPG for all trips so far is 16.6667 Enter Mileage for Trip #3 : -1 Thank you for using our MPG program!