Question

Days of the week Write a program that asks the user for a number in the...

Days of the week

Write a program that asks the user for a number in the range of 1 through 7. The program should display the corresponding day of the week, where 1 = Monday, 2 = Tuesday, 3 = Wednesday, 4 = Thursday, 5 = Friday, 6 = Saturday, and 7 = Sunday. The program should display an error message if the user enters a number that is outside of the range of 1 though 7.

Homework Answers

Answer #1


#include <iostream>
#include <string>
using namespace std;
int main()
{
int Day;
cout<<"Enter the day: ";
cin>>Day; // INPUT
if (Day == 1){ //CASES
cout<<"Monday";
}
else if (Day==2){
cout<<"Tuesday";
}
  
else if (Day==3){
cout<<"Wednesday";
}
  
else if (Day==4){
cout<<"Thursday";
}
  
else if (Day==5){
cout<<"Friday";
}
  
else if (Day==6){
cout<<"Saturday";
}
else if (Day==7){
cout<<"Sunday";
}
else{ //BAD CASE
cout<<"outside of the range of 1 though 7"<<endl;
}
  

}

OUTPUT:

IF YOU HAVE ANY QUERY PLEASE COMMENT DOWN BELOW

PLEASE GIVE A THUMBS UP

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write a program that asks the user for a number in the range 1 through 12....
Write a program that asks the user for a number in the range 1 through 12. The program should display the corresponding month of the year, where 1 = January, 2 = February, 3 = March, 4 = April, 5 = May, 6 = June, 7 = July, 8 = August, 9 = September, 10 = October, 11 = November, and 12 = December. The program should display an error message if the user enters a number that is outside...
Write a function num_day that takes a number in the range of 1 through 7 as...
Write a function num_day that takes a number in the range of 1 through 7 as a parameter and returns a string representing the corresponding day of the week, where 1=Monday, 2 =Tuesday, 3= Wednesday, 4 = Thursday, 5 = Friday, 6 = Saturday, and 7 = Sunday. The function should return the string "Error" if the parameter is that is outside the range of 1 through 7. You may assume that the parameter will be only numbers. Save the...
As a small restaurant owner, you are very interested in understanding the demand of your different...
As a small restaurant owner, you are very interested in understanding the demand of your different products. You have been collecting data over the past 11 weeks on the number of fish platter sales that you make each day. You want to run a simulation and you believe that 60% of your fish platter sales for a given week show up on the weekends (evenly split between Friday, Saturday and Sunday) while the remaining 40% are evenly divided across the...
10. (17 pts) A person wants to determine whether the proportion of children born each day...
10. (17 pts) A person wants to determine whether the proportion of children born each day of the week is the same or not in a city; that is, the expected relative frequencies are as follows: Day of Week Relative Frequency Sunday 1/7 Monday 1/7 Tuesday 1/7 Wednesday 1/7 Thursday 1/7 Friday 1/7 Saturday 1/7 The person randomly selected a sample of 500 children and the result is as follows: Day of Week Frequency Sunday 57 Monday 78 Tuesday 74...
MW is a large discount store that operates seven days per week. The store needs the...
MW is a large discount store that operates seven days per week. The store needs the following number of full-time employees working each day of the week. Sunday Monday Tuesday Wednesday Thursday Friday Saturday num of employees 188 88 112 140 136 172 212 Each employee must work five consecutive days each week and then have two days off. For example, any employee who works Sunday through Thursday has Friday and Saturday off. The store currently has a total of...
Employers particularly want to know which days of the week employees are absent in a five-day...
Employers particularly want to know which days of the week employees are absent in a five-day work-week. Most employers would like to believe that employees are absent equally during the week. That is, the average number of times an employee is absent is the same on Monday, Tuesday Wednesday, Thursday, or Friday. Suppose a sample of 20 absent days was taken and the days absent were distributed as follows: Monday Tuesday Wednesday Thursday Friday Number of Absences 5 4 2...
A historic distribution information of people visit on a grocery store is: Monday: 10%; Tuesday 10%;...
A historic distribution information of people visit on a grocery store is: Monday: 10%; Tuesday 10%; Wednesday: 10%; Thursday: 15%; Friday: 15%; Saturday: 20%; Sunday 20%. The total is 100%. A test is conducted by counting the number of people visits each day: Monday: 150; Tuesday 110; Wednesday: 155; Thursday: 160; Friday: 180; Saturday: 240; Sunday: 190. Based on the information, can you conclude with 95% confidence that your test result agree with the historic information?
Problem 5:  Below is 4 weeks of sales data for a restaurant that is open 5 days...
Problem 5:  Below is 4 weeks of sales data for a restaurant that is open 5 days a week (Tuesday-Saturday).   a. Develop an Exponential Smoothing forecast.  Use an alpha of .85 and assume the initial forecast for January is 975 b. Calculate the MAD for this forecast. Actual Day Demand Tuesday 975 Wednesday 1225 Thursday 1445 Friday 1750 Saturday 2160 Tuesday 1500 Wednesday 750 Thursday 895 Friday 1500 Saturday 1445 Tuesday 1025 Wednesday 650 Thursday 850 Friday 980 Saturday 1500 Tuesday 750...
Records of randomly selected births were obtained and categorised based on the day of the week...
Records of randomly selected births were obtained and categorised based on the day of the week the birth occurred, which is provided below. Since babies are unaware of the tradition work week, it would be reasonable to assume the distribution of births would occur equally on each of the days of the week. At 1% level of significance, test the claim. Can you think of an explanation for the result? Day Sunday Monday Tuesday Wednesday Thursday Friday Saturday Number of...
The National Highway Traffic Safety Administration reported the percentage of traffic accidents occurring each day of...
The National Highway Traffic Safety Administration reported the percentage of traffic accidents occurring each day of the week. Assume that a sample of 420 accidents provided the following data. Sunday Monday Tuesday Wednesday Thursday Friday Saturday 69 47 54 49 58 69 74 a. Conduct a hypothesis test to determine if the proportion of traffic accidents is the same for each day of the week. What is the p-value? Compute the value of the X2 test statistic (to 3 decimals)....