Question

(C++ Program) Create an enum (enumeration) for the Months of the Year. Use a Switch statement...

(C++ Program)

Create an enum (enumeration) for the Months of the Year.

Use a Switch statement Selection structure to output the Various International/Domestic Holidays for each month as following:

Jan - New Years Day

Feb - Valentines Day

March - St. Patrick's Day

April - Earth Day

May - MayPole Day

June - Juneteenth

July - Eid-al-Adha

August - National Mahjong Day

September - Talk Like a Pirate Day

October - United Nations Day

November - International Computer Security Day

December - Human Rights Day

Homework Answers

Answer #1

c++ Program :

//header files
#include <iostream>
using namespace std;
//enum
enum Months{
Jan,Feb,March,April,May,June,July,August,September,
October,November,December
};
//main() method
int main()
{
int month;//declaring variable to store month
//asking user month
cout<<"Enter month : ";
cin>>month;//reading month
//using switch statement
switch(month)
{
case 0://when month is Jan
cout<<"Jan-New Years Day"<<endl;
break;
case 1://when month is Feb
cout<<"Feb - Valentines Day"<<endl;
break;
case 2://when month is March
cout<<"March - St. Patrick's Day"<<endl;
break;
case 3://when month is April
cout<<"April - Earth Day"<<endl;
break;
case 4://when month is May
cout<<"May - MayPole Day"<<endl;
break;
case 5://when month is June
cout<<"June - Juneteenth"<<endl;
break;
case 6://when month is July
cout<<"July - Eid-al-Adha"<<endl;
break;
case 7://when month is August
cout<<"August - National Mahjong Day"<<endl;
break;
case 8://when month is September
cout<<"September - Talk Like a Pirate Day"<<endl;
break;
case 9://when month is October
cout<<"October - United Nations Day"<<endl;
break;
case 10://when month is November
cout<<"November - International Computer Security Day"<<endl;
break;
case 11://when month is December
cout<<"December - Human Rights Day"<<endl;
break;
default://when invalid number is entered
cout<<"Enter valid month"<<endl;
break;
}
return 0;
}
==========================================

Screen 1:Screen when invalid month is entered

Screen 2:Screen when valid month is entered

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
Nurseries grows and sells garden plants. The nursery is active between January and October each year....
Nurseries grows and sells garden plants. The nursery is active between January and October each year. During January, the potting tables and equipment are prepared. The potting and seeding are done in February. In March and April, the plants are cultivated, watered, and fertilized. May and June are the peak selling months. July, August, and September are the peak months for visiting customers in their homes to provide them with advice and help solve their problems. During October, the equipment...
Merck, AIDS, and Africa Written July 2001, Revised October 23, 2003 Merck was being pilloried in...
Merck, AIDS, and Africa Written July 2001, Revised October 23, 2003 Merck was being pilloried in the international press. The issue? Its role in AIDS crisis in Sub-Saharan Africa, where the price of AIDS treatments far exceeded patients’ ability to pay. The fallout from public opinion threatened not only Merck’s valued reputation, but the international system of prices and intellectual property rights on which Merck’s business was based. The Pharmaceuticals Industry The pharmaceuticals industry is known for its enormous investments...
Mattel Responds to Ethical Challenges Business Ethics This case was written by Debbie Thorne, John Fraedrich,...
Mattel Responds to Ethical Challenges Business Ethics This case was written by Debbie Thorne, John Fraedrich, O. C. Ferrell, and Jennifer Jackson, with the editorial assistance of Jennifer Sawayda. This case was developed for classroom discussion rather than to illustrate either effective or ineffective handling of an administrative, ethical, or legal discussion by management. All sources used for this case were obtained through publicly available material. Mattel, Inc. is a world leader in the design, manufacture, and marketing of family...
Delta airlines case study Global strategy. Describe the current global strategy and provide evidence about how...
Delta airlines case study Global strategy. Describe the current global strategy and provide evidence about how the firms resources incompetencies support the given pressures regarding costs and local responsiveness. Describe entry modes have they usually used, and whether they are appropriate for the given strategy. Any key issues in their global strategy? casestudy: Atlanta, June 17, 2014. Sea of Delta employees and their families swarmed between food trucks, amusement park booths, and entertainment venues that were scattered throughout what would...
Using the model proposed by Lafley and Charan, analyze how Apigee was able to drive innovation....
Using the model proposed by Lafley and Charan, analyze how Apigee was able to drive innovation. case:    W17400 APIGEE: PEOPLE MANAGEMENT PRACTICES AND THE CHALLENGE OF GROWTH Ranjeet Nambudiri, S. Ramnarayan, and Catherine Xavier wrote this case solely to provide material for class discussion. The authors do not intend to illustrate either effective or ineffective handling of a managerial situation. The authors may have disguised certain names and other identifying information to protect confidentiality. This publication may not be...
What role could the governance of ethics have played if it had been in existence in...
What role could the governance of ethics have played if it had been in existence in the organization? Assess the leadership of Enron from an ethical perspective. THE FALL OF ENRON: A STAKEHOLDER FAILURE Once upon a time, there was a gleaming headquarters office tower in Houston, with a giant tilted "£"' in front, slowly revolving in the Texas sun. The Enron Corporation, which once ranked among the top Fortune 500 companies, collapsed in 2001 under a mountain of debt...
Discuss ethical issues that can be identified in this case and the mode of managing ethics...
Discuss ethical issues that can be identified in this case and the mode of managing ethics Enron finds itself in this case. How would you describe the ethical culture and levels of trust at Enron? Provide reasons for your assessment. THE FALL OF ENRON: A STAKEHOLDER FAILURE Once upon a time, there was a gleaming headquarters office tower in Houston, with a giant tilted "£"' in front, slowly revolving in the Texas sun. The Enron Corporation, which once ranked among...
Discuss how the respective organizations’ relations with stakeholders could have potentially been affected by the events...
Discuss how the respective organizations’ relations with stakeholders could have potentially been affected by the events that took place at Enron and how the situation could have been dealt with differently to prevent further damage? THE FALL OF ENRON: A STAKEHOLDER FAILURE Once upon a time, there was a gleaming headquarters office tower in Houston, with a giant tilted "£"' in front, slowly revolving in the Texas sun. The Enron Corporation, which once ranked among the top Fortune 500 companies,...
Please answer the following Case analysis questions 1-How is New Balance performing compared to its primary...
Please answer the following Case analysis questions 1-How is New Balance performing compared to its primary rivals? How will the acquisition of Reebok by Adidas impact the structure of the athletic shoe industry? Is this likely to be favorable or unfavorable for New Balance? 2- What issues does New Balance management need to address? 3-What recommendations would you make to New Balance Management? What does New Balance need to do to continue to be successful? Should management continue to invest...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT