Answer to Question #288247 in C for Ash

Question #288247

Mr. Sharma has travel plans. He wants to know the distance travelled in kilometers [KM] to destination on October 15th. Initially Mr. Sharma travels a fixed distance of 40 KM from his house to Airport. If October 15th is a Full working day he travels 2200 KM to attend a Conference at Delhi, if it is a half working day he travels 350 KM to attend a Conference at Chennai, if it is a Holiday he travels 600 KM for a Holiday in Goa.

Following are requirements to solve the problem

a. The working day status i.e., Full working day, half working day or Holiday on October 15th has to be captured.

b. Check for the given conditions and compute the total distance

c. Display the distance travelled in KM along with the destination in an appropriate message. 



1
Expert's answer
2022-01-17T12:57:58-0500
#include <stdio.h>
enum Day{working, half, holiday};
int main(int argc, char* argv[])
{
    printf("Full working day in 2022 year");
    Day d = Day::working;
    int distance = 40;
    if (d == Day::working)
    {
        distance += 2200;
    }
    else if (d == Day::half)
    {
        distance += 350;
    }
    else
    {
        distance += 600;
    }


    printf(" %s %d", "He will travel on 15tt of October ", distance);
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS