Question: This problem is based on Chapter 4 Problem #8. Given the pollutant type, how much is being emitted, and the odometer reading of the car,

This problem is based on Chapter 4 Problem #8. Given the pollutant type, how much is being emitted, and\ the odometer reading of the car, you are supposed to calculate whether the car is legal (within the limits) or\ illegal (exceeding the limits)\ 1 t y p e d e f enum p o l l u t a n t _ t y p e { c a r b o n _ m o n o x i d e , h y d r o c a r b o n s ,\ 2 n i t r o g e n _ o x i d e s , n o n m e t h a n e _ h y d r o c a r b o n s } p o l l u t a n t _ t y p e ;\ 3 t y p e d e f enum p o l l u t a n t _ l e v e l _ t y p e { l e g a l , i l l e g a l } p o l l u t a n t _ l e v e l _ t y p e ;\ 4 p o l l u t a n t _ l e v e l _ t y p e e m i s s i o n s ( p o l l u t a n t _ t y p e p , d o u b l e g r a m s _ p e r _ m i l e , i n t o d o m e t e r ) ;\ You see two typedefs here: one for an enum of types of pollutants and one for an enum for legal or illegal.\ Line 5 is the specification of the function you are to build. It has three parameters:\ 1. pollutant_type p: one of the pollutant_type values\ 2. double gram_per_mile: the rate the car is emitting that pollutant\ 3. int odometer: how far the car has been driven.\ Your job is to make the function return either illegal or legal based on the table in the book. Note that the\ values in the table are legal - only exceeding them is illegal. You can also assume that the second column will\ be used for all odometer readings over 50,000. When you are ready, you can submit it to the Conditionals\ - 5" assignment in CodeGrade.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!