MYPROGRAMMINGLAB WITH PEARSON ETEXT
MYPROGRAMMINGLAB WITH PEARSON ETEXT
8th Edition
ISBN: 9780134225340
Author: Deitel
Publisher: PEARSON
Question
Book Icon
Chapter 7, Problem 7.33MD
Program Plan Intro

Program Plan:

  • Declare prototype for three functions building_CF, car_CF and bicycle_CF.
  • Inside main function,
    • Declare array of function f to point to three functions building_CF, car_CF and bicycle_CF.
    • Declare an integer variable choice to store the user’s choice
    • Use while loop to repeatedly take user’s choice and call different function using array of function.
  • Define function building_CF. Inside this function ask from user for various parameters that can contribute to CO2 emission. Based on value of these paramters and emission factor calculate the carbon foot print for building.
  • Similar as above define function car_CF and bicycle_CF. The CO2 emission of car will be based on type of fuel used in it and for bicyle CO2 emission will depend on the distance travelled.

Summary Introduction: The program uses CO2 emission factors of various fuels used to calculate the carbon footprint for any building, car or bicycle. The program defines three functions for each type of carbon footprint calculation and calls them using array of function.

Program Description:The program prompts the user to enter the type of carbon footprint to calculate and then based on his/her choice uses the array of function to calculate the carbon footprint.

Blurred answer
Students have asked these similar questions
I would like to know the main features about the following 3 key concepts:1. Backup Domain Controller (BDC)2. Access Control List (ACL)3. Dynamic Memory
In cell C21, enter a formula to calculate the number of miles you expect to drive each month. Divide the value of number of miles (cell A5 from the Data sheet) by the average MPG for the vehicle multiplied by the price of a gallon of gas (cell A6 from the Data sheet).
Microsoft Excel
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,