Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I already have the solution for part 1 and now I need the source code for part 2 according to the instructions and same as

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

I already have the solution for part 1 and now I need the source code for part 2 according to the instructions and same as the output show here. The solution for part 1 was:

printf("\tERROR: The year must be between 2010 and 2021 inclusive "); }

//if month is valid set monthValid to 1 if (month >= 1 && month

printf(" *** Log date set! *** ");

if (month == 1) printf("Log starting date: %d-JAN-01", year); else if (month == 2) printf("Log starting date: %d-FEB-01", year); else if (month == 3) printf("Log starting date: %d-MAR-01", year); else if (month == 4) printf("Log starting date: %d-APR-01", year); else if (month == 5) printf("Log starting date: %d-MAY-01", year); else if (month == 6) printf("Log starting date: %d-JUN-01", year); else if (month == 7) printf("Log starting date: %d-JUL-01", year); else if (month == 8) printf("Log starting date: %d-AUG-01", year); else if (month == 9) printf("Log starting date: %d-SEP-01", year); else if (month == 10) printf("Log starting date: %d-OCT-01", year); else if (month == 11) printf("Log starting date: %d-NOV-01", year); else if (month == 12) printf("Log starting date: %d-DEC-01", year); return 0;

1. Review the "Part-1 Output Example" (next section) to see how this program is expected to work 2. Code your program in the file named "w3p1.c" IMPORTANT: DO NOT use arrays in this workshop! 3. After the system library #include, and before the main function, define two (2) macros: #define MIN_YEAR 2010 #define MAX_YEAR 2021 4. Inside the main function, declare two (2) unmodifiable integer variables "JAN" and "DEC" representing the first and last months of the year respectively (initialize "JAN" to 1 and "DEC" to 12) 5. Display the title for the well-being log application 6. Nest inside an iteration construct the following: a) Display the following message: >Set the year and month for the well-being log (YYYY MM): *** Log date set! **** 9. Display the log start date in the format: YYYY-MMM-DD YYYY: The year as 4-digits MMM: First 3-characters of the month name DD: The 2-digit day Note: The log will start on the 1st day of the month entered by the user Hint: You need to implement alternative/multiple selection to map the month integer value to the respective 3-character month representation. There are a couple of constructs available to you that will make this possible! Part-1 Output Example (Note: Use this data for submission) General Well-being Log ====================== Set the year and month for the well-being log (YYYY MM): 2009 1 ERROR: The year must be between 2010 and 2021 inclusive Set the year and month for the well-being log (YYYY MM): 2022 1 ERROR: The year must be between 2010 and 2021 inclusive Set the year and month for the well-being log (YYYY MM): 2021 0 ERROR: Jan.(1) - Dec. (12) Set the year and month for the well-being log (YYYY MM): 2021 13 ERROR: Jan.(1) - Dec. (12) Set the year and month for the well-being log (YYYY MM): 2009 ERROR: The year must be between 2010 and 2021 inclusive ERROR: Jan.(1) - Dec. (12) Set the year and month for the well-being log (YYYY MM): 2022 13 ERROR: The year must be between 2010 and 2021 inclusive ERROR: Jan.(1) - Dec. (12) Set the year and month for the well-being log (YYYY MM): 2021 2 *** Log date set! *** Log starting date: 2020-FEB-01 1. Review the "Part-2 Output Example" (next section) to see how the program is expected to work 2. Add another macro to define the maximum days (3) of data to collect from the user: #define LOG_DAY'S 3 Note: This program must be coded in such a manner that it will work no matter what value is set for LOG_DAYS, 3-300-3000- or more 3. Continuing from Part-1, use a for iteration construct to loop the necessary number times based on the defined LOG_DAYS Note: _You will need to create additional variables. Be sure to place them at the beginning of the main function so all variables are organized and grouped together and in one place 4. Nest inside the for construct, the following: a) Display the current log date in the format: YYYY-MMM-DD as described in Part-1 Note: The day value must be derived from a variable and not hard-coded, and remember the log always begins on the 1st day of the month b) For each day, you need to read two (2) double floating-point user input values that represent a morning and an evening self-diagnosis rating value c) Display a prompt to get the user input value for the "morning" diagnosis. This is a value that should be between 1.0 and 5.0 inclusive (refer to the example output) d) Validate the rating value entered by the user. An incorrect value that is out of range, should display the appropriate error message and prompt again for a value and repeat as many times as is necessary until a valid value is entered e) Repeat the same logic from step: c) above only for the "evening" diagnosis. f) Repeat from step #4 until the number of desired days is reached 5. After all the data is entered by the user, a summary should be displayed consisting of the following: The sum of all the valid values entered for the morning ratings The sum of all the valid values entered for the evening ratings The sum of all the valid values entered for the combined morning and evening ratings o Note: Display all sums to 3-decimal precision points The average morning rating based on the number of LOG_DAYS of data entered The average evening rating based on the number of LOG_DAYS of data entered . . . The average combined morning and evening rating based on the number of LOG_DAYS of data entered o Note: Display all averages to 1-decimal precision point Part-2 Output Example (Note: Use this data for submission) General well-being Log Set the year and month for the well-being log (YYYY MM): 2889 1 ERROR: The year must be between 2018 and 2021 inclusive Set the year and month for the well-being log (YYYY MM): 2822 1 ERROR: The year must be between 2012 and 2021 inclusive Set the year and month for the well-being log (YYYY MM): 2821 2 ERROR: Jan. (1) - Dec. (12) Set the year and month for the well-being log (YYYY MM): 2821 13 ERROR: Jan. (1) - Dec. (12) Set the year and month for the well-being log (YYYY MM): 2009 ERROR: The year must be between 2010 and 2021 inclusive ERROR: Jan.(1) - Dec. (12) Set the year and month for the well-being log (YYYY MM): 2822 13 ERROR: The year must be between 2019 and 2021 inclusive ERROR: Jan. (1) - Dec. (12) Set the year and month for the well-being log (YYYY MM): 2821 2 *** Log date set! *** 2021-FEB-01 Moming rating (2.9-5.0): -0.9 ERROR: Rating must be between 3.0 and 5.0 inclusive! Morning rating (0.8-5.a): 5.01 ERROR: Rating must be between 8.0 and 5.0 inclusive! Morning rating (0.0-5.a): 4.25 Evening rating (0.0-5.0): -0.9 ERROR: Rating must be between 0.@ and 5.0 inclusive! Evening rating (0.8-5.a): 5.61 ERROR: Rating must be between 0.0 and 5.0 inclusive! Evening rating (0.8-5.a): 5 2021-FEB-82 Morning rating (0.8-5.2): 2 Evening rating (0.9-5.a): 4.9 2021-FEB-83 Morning rating (0.8-5.a): 5 Evening rating (0.0-5.0): @ Summary EEEEEE Morning total rating: 9.250 Evening total rating: 9.900 Overall total rating: 19.159 Average morning rating: Average evening rating: 3.1 3.3 Average overall rating: 3.2

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

Step: 3

blur-text-image

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

Concepts Of Database Management

Authors: Joy L. Starks, Philip J. Pratt, Mary Z. Last

9th Edition

1337093424, 978-1337093422

More Books

Students also viewed these Databases questions

Question

1. Where do these biases come from?

Answered: 1 week ago