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.
#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;
}
Comments
Leave a comment