Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Complete a program that has a user enter a pollutant choice, a number of grams of the pollutant emitted per mile, and an odometer reading

Complete a program that has a user enter a pollutant choice, a number of grams of the
pollutant emitted per mile, and an odometer reading (0-100000).
Output an indication of whether or not they are compliant with the following regulations:
first 50,000 miles second 50,000 miles
carbon monoxide 3.4 grams/mile 4.2 grams/mile
hydrocarbons 0.31 grams/mile 0.39 grams/mile
nitrogen oxides 0.4 grams/mile 0.5 grams/mile
non-methane hydrocarbons 0.25 grams/mile 0.31 grams/mile
A sample run is shown here:
Your program must
1. Not change any of the given code.
2. Use the defined constant variables for any constant values in your program.
3. Create additional constant variables to use when checking the mileage
boundaries (50000 miles and 100000 miles).
4. Output an indication that an invalid odometer reading has been entered (outside
of the range of 0-100000).
5. Use the switch statement started in the program for your decision structure.
6. Have at least one other user defined function. One possibility is the following
function that determines the allowable level for a particular pollutant:
double getAllowableLevel (double gramsPerMileAllowed1, double
gramsPerMileAllowed2, int odometer);

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Real Time Database Systems Architecture And Techniques

Authors: Kam-Yiu Lam ,Tei-Wei Kuo

1st Edition

1475784023, 978-1475784022

More Books

Students also viewed these Databases questions