Code writing Meridian Corporation of Fremont is trying to decide whether to reward employees who carpool to work. The proposed plan is to pay each employee in the carpool $ 0.08 per mile if the minimum passenger efficiency of 25.0 is met. The passenger efficiency is calculated as P = nm G where n is the number of people in the carpool, m is the distance traveled in miles and G is the number of gallons of fuel used. The file opened in part A (do not open it again but do have a reference to it as a parameter) contains data on existing carpools. The input file represents each existing carpool as a line of data containing the number of people in the carpool, the total commuting distance for a five-day work week, and the number of gallons used. Write a function called calcEfficiency to process this file until the end of data. Calculate the passenger efficiency for each carpool and if the efficiency is greater than 25.0 Use no arrays! then output the passenger efficiency and the amount to be rewarded to the screen. Paste in only the function definition - not main() even it you wrote it to test your program. Sample carpool.txt 2 80 4 3 125 10.5 2 350 15.9 Sample output Screen: Efficiency Money 40.0 $ 6.40 35.7 $10.00 44.0

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Use C++ to write a program.

Use no arrays!

#include <iostream>

#include <iomanip>

and no more!

Code writing
Meridian Corporation of Fremont is trying to decide whether to reward employees who carpool to
work. The proposed plan is to pay each employee in the carpool $ 0.08 per mile if the minimum
passenger efficiency of 25.0 is met. The passenger efficiency is calculated as
P = nm
G
where n is the number of people in the carpool, m is the distance traveled in miles and G is the
number of gallons of fuel used.
The file opened in part A (do not open it again but do have a reference to it as a parameter) contains
data on existing carpools. The input file represents each existing carpool as a line of data containing
the number of people in the carpool, the total commuting distance for a five-day work week, and the
number of gallons used. Write a function called calcEfficiency to process this file until the end of
data. Calculate the passenger efficiency for each carpool and if the efficiency is greater than 25.0
Use no arrays!
then output the passenger efficiency and the amount to be rewarded to the screen.
Paste in only the function definition - not main() even it you wrote it to test your program.
Sample carpool.txt
2 80 4
3 125 10.5
2 350 15.9
Sample output Screen:
Efficiency
Money
40.0
$ 6.40
35.7
$10.00
44.0
Transcribed Image Text:Code writing Meridian Corporation of Fremont is trying to decide whether to reward employees who carpool to work. The proposed plan is to pay each employee in the carpool $ 0.08 per mile if the minimum passenger efficiency of 25.0 is met. The passenger efficiency is calculated as P = nm G where n is the number of people in the carpool, m is the distance traveled in miles and G is the number of gallons of fuel used. The file opened in part A (do not open it again but do have a reference to it as a parameter) contains data on existing carpools. The input file represents each existing carpool as a line of data containing the number of people in the carpool, the total commuting distance for a five-day work week, and the number of gallons used. Write a function called calcEfficiency to process this file until the end of data. Calculate the passenger efficiency for each carpool and if the efficiency is greater than 25.0 Use no arrays! then output the passenger efficiency and the amount to be rewarded to the screen. Paste in only the function definition - not main() even it you wrote it to test your program. Sample carpool.txt 2 80 4 3 125 10.5 2 350 15.9 Sample output Screen: Efficiency Money 40.0 $ 6.40 35.7 $10.00 44.0
Expert Solution
steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education