Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The code working very well, just I want to add zero before 1,2 and3 for the date 2022-FEB-01, 02 and 2022-FEB-03 that's it nothing more?

The code working very well, just I want to add zero before 1,2 and3 for the date 2022-FEB-01, 02 and 2022-FEB-03 that's it nothing more?

code:

#include //Macros#define MIN_YEAR 2012#define MAX_YEAR 2022#define LOG_DAYS 3//Main functionint main() {//declaration of variables for month value and year value to be entered by userint month, year;//declaration and initialization of unmodifiable integersconst int JAN=01;const int DEC=12;//declaration of additional variablesint log;//declaration of variables for morning rating value and evening rating value to be entered by userdouble morning_rating; double evening_rating;//declaration of variables to store sum of all morning rating values and all evening rating values entered by userdouble total_morning_rating=0.0, total_evening_rating=0.0;//displays title for well being application logprintf("General Well-being Log ");printf("====================== ");//iterationdo{ //get input for year and month from the user printf("Set the year and month for the well-being log (YYYY MM): "); scanf("%d %d", &year,&month); //condition for validating year value entered by user if (year > MAX_YEAR || year  DEC ) { printf(" ERROR: Jan.(1) - Dec.(12) "); } //iteration condition for valid year and month value} while (year > MAX_YEAR || year  12); printf(" *** Log date set! *** ");//for iterationfor(log=(1); log 5.0) { printf(" ERROR: Rating must be between 0.0 and 5.0 inclusive! "); } else { //calculate sum of morning rating values entered by the user total_morning_rating+=morning_rating; } //iteration condition for valid morning rating value } while (morning_rating  5.0); //evening rating do { //get value for evening rating from the user printf(" Evening rating (0.0-5.0): "); scanf("%lf", &evening_rating); //condition for validating evening rating value entered by user if (evening_rating  5.0) { printf(" ERROR: Rating must be between 0.0 and 5.0 inclusive! "); } else { //calculate sum of evening rating values entered by the user total_evening_rating+=evening_rating; } //iteration condition for valid evening rating value } while (evening_rating  5.0);} //display Summaryprintf(" Summary ");printf("======= ");//display sum of all valid morning rating valuesprintf("Morning total rating: %.3lf ",total_morning_rating);//display sum of all valid evening rating valuesprintf("Evening total rating: %.3lf ",total_evening_rating);printf("---------------------------- ");//display overall valid morning and evening rating valuesprintf("Overrall total rating: %.3lf ",total_morning_rating+total_evening_rating);//display average of all valid morning rating valuesprintf(" Average morning rating: %.1lf ",total_morning_rating/LOG_DAYS);//display average of all valid evening rating valuesprintf("Average evening rating: %.1lf ",total_evening_rating/LOG_DAYS);printf("---------------------------- ");//display average of overall rating values printf("Average overrall rating: %.1lf ",((total_morning_rating/LOG_DAYS)+(total_evening_rating/LOG_DAYS))/2);return 0;}

image text in transcribed
2022-FEB-01 Morning rating (0.0-5.0): -0.8 ERROR: Rating must be between 0.0 and 5.0 inclusive! Morning rating (0.0-5.0): 5.01 ERROR: Rating must be between 0.0 and 5.0 inclusive! Morning rating (0.0-5.0): 4.22 Evening rating (0.0-5.0): -0.7 ERROR: Rating must be between 0.0 and 5.0 inclusive! Evening rating (0.0-5.0): 5.01 ERROR: Rating must be between 0.0 and 5.0 inclusive! Evening rating (0.0-5.0): 5 2022-FEB-02 Morning rating (0.0-5.0): 1 Evening rating (0.0-5.0): 4.6 2022-FEB-03 Morning rating (0.0-5.0): 4.8 Evening rating (0.0-5.0): 0

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

Students also viewed these Programming questions

Question

Highest active volcano of the south america ?

Answered: 1 week ago

Question

Where would you see the nodes of ranvier ?

Answered: 1 week ago

Question

Damage to the hippocampus is the most likely to impair ?

Answered: 1 week ago

Question

The terminal buttons of a neuron are located at the end of its ?

Answered: 1 week ago

Question

The effect of neurotransmitters may be..........?

Answered: 1 week ago