Question: Please do in clion c executable c 9 9 . practice.c and practice.h code that was given is included. Also please don't answer using python

Please do in clion c executable c 99. practice.c and practice.h code that was given is included. Also please don't answer using python code or an answer that doesn't even use anything in the question. thank you
Q1: How Many Days ...
7. Write a program that determines the day number (1 to 366) in a year for a date that is provided as input data. As an example, January 1,1994, is day 1. December 31,1993, is day 365. December 31,1996, is day 366, since 1996 is a leap year. A year is a leap year if it is divisible by four, except that any year divisible by 100 is a leap year on accept the month, day, and year as integers. Include a function leap that retuns 1 if called with a leap year, o otherwise. This problem is based on Chapter 4 Problem #7: Given a month, day, and year, calculate how many days
into the year that date is. This is the framework:
1// c h a p t e r 4 q u e s t i o n 7
2 i n t l e a p ( i n t y e a r ) ;
3 i n t day_number ( i n t month , i n t day , i n t y e a r ) ;
The problem is really only asking you to build the day_number function, but, its easier to build that if we
have a function that tells us whether a given year is a leap year. Therefore, build the leap function first and
have it return 1 if the year is a leap year and zero otherwise. Then, use that to build the day_number function.
Q 2: Pollutants
Write a program that interacts with the user like this (1) Carbon monoxide (2) Hydrocarbons (3) Nitrogen oxides 4) Nonmethane hydrocarbons Enter pollutant number>> Enter number of grams emitted per mile> Enter odometer reading>>0212 Emissions exceed permitted level of 0.31 grams/mile.0.35 Use the table of emissions limits below to determine the appropriate r message.1 First 50,000 Miles Second 50,000 Miles .4 grams/mile 0.31 grams/mile 0.4 grams/mile 0.25 grams/mile carbon monoxide 4.2 grams/mile 0.39 grams/mile 0.5 grams/mile 0.31 grams/mile nitrogen oxides nonmethane hydrocarbons. 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// c h a p t e r 4 q u e s t i o n 8
2 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 ,
3 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 ;
4 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 ;
5 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 a enum of the types of pollutants and one for an enum for legal or illegal.
Line 4 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 odomoter: 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
practic.c code:
int leap(int year){
/* Your code here*/
return 1;
}
int day_number(int month, int day, int year){
/* Your code here*/
return 1;
}
//pollutant_level_type emissions(enum pollutant_level_type p, double grams_per_mile, int odometer){
/* Your code here*/
// return carbon_monoxide;
//}
practice.h code:
//chapter 4 question 7
int leap(int year);
int day_number(int month, int day, int year);
//chapter 4 question 8
enum pollutant_level_type{carbon_monoxide, hydrocarbons, nitrogen_oxides, nonmethane_hydrocarbons};
double emissions(enum pollutant_level_type p, double grams_per_mile, int odometer);

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!