Write a basic C++ using Microsoft Visual program that interacts with the user li
ID: 3557933 • Letter: W
Question
Write a basic C++ using Microsoft Visual program that interacts with the user like this:
(1) Carbon monoxide
(2) Hydrocarbons
(3) Nitrogen oxides
(4) Nonmethane hydrocarbons
Enter the pollutant number>> 2
Enter the number of grams emitted per mile>> 0.35
Enter odometer reading>> 40112
Emissions exceed permitted level of 0.31 grams/mile.
Use this table of emissions:
Emissions First 50,000miles Second 50,000 miles
carbonmonoxide 3.4grams/mile 4.2 grams/mile
hydrocarbons 0.31grams/mile 0.39 grams/mile
nitrogenoxides 0.4grams/mile 0.5 grams/mile
nonmethane hydrocarbons 0.25grams/mile 0.31 grams/mile
Use a loop to allow the user to input the data multiple times. Exit the program when the user enters the letter Z
Explanation / Answer
#include // Preprocessor directives using namespace std; int main () // The program starts here { // Declaring variables int pollutant_number(0); int odometer_reading(0); double grams_emitted_per_mile(0); char answer; do // Allow for multiple runs of the program with a do-while loop { //Information displayed to the user coutRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.