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...


Write a program as picture required.


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

Extracted 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

Jun 03, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions ยป

Submit New Assignment

Copy and Paste Your Assignment Here