You will implement a day of week calculator for the 2021 calendar year. The calculator repeatedly reads in three numbers (in a line) from the standard input that is interpreted as dayofmonth, month...

You will implement a day of week calculator for the 2021 calendar year. The calculator repeatedly reads in three numbers (in a line) from the standard input that is interpreted as dayofmonth, month and daysafter. This program calculates the days of the week for the dates and outputs the information. For example, input “1 1 31” is interpreted as the following: the first 1 means the 1st day in January; the second 1 means the 1st month in the year, January; and the 31 means 31 days after the date 1 January 2021 (we assume the year is 2021 to simplify the program), which is Monday on 1 February 2021. More specifically, for input “1 1 31”, the calculator should produce the following output: “31 days after Friday, 1 January 2021 is Monday, February 1, 2021. “ The first input number must be a day in the month (e.g. for 1-31 for January, 1-28 for February, and so forth). The second input number must be from 1 to 12 representing the 12 months in 2021. The third number is larger than or equal to 0 and must be less than 100. The program should report an error (and exit) if the input is incorrect.


Assignment 2 Object Oriented Programming 5 Marks You will implement a day of week calculator for the 2021 calendar year. The calculator repeatedly reads in three numbers (in a line) from the standard input that is interpreted as dayofmonth, month and daysafter. This program calculates the days of the week for the dates and outputs the information. For example, input “1 1 31” is interpreted as the following: the first 1 means the 1st day in January; the second 1 means the 1st month in the year, January; and the 31 means 31 days after the date 1 January 2021 (we assume the year is 2021 to simplify the program), which is Monday on 1 February 2021. More specifically, for input “1 1 31”, the calculator should produce the following output: “31 days after Friday, 1 January 2021 is Monday, February 1, 2021. “ The first input number must be a day in the month (e.g. for 1-31 for January, 1-28 for February, and so forth). The second input number must be from 1 to 12 representing the 12 months in 2021. The third number is larger than or equal to 0 and must be less than 100. The program should report an error (and exit) if the input is incorrect. Few Sample inputs are: Input 1 1 20 Output 20 days after Friday,1 January 2021 is Thursday, 21 January 2021. Input 1 2 0 Output 0 days after Monday, 1 February 2021 is Monday, 1 February 2021. Requirements: 1. In this assignment, you need to design and implement a date2021 class. 2. The date2021 class should have two private data members of the int type, d, and m with m encoding the month (1 – January, 2-February, …) and d being the day in the month. For example to represent April 5, d = 5, m = 4. 3. The date2021 class should have the following public functions: date2021( ); // no argument constructor date2021(int dd); //set d as one argument constructor date2021(int dd, int mm); //set d and m as 2 argument constructor void setdate(int dd, int mm); //set d and m as a method void print( ); // display result on screen void plusday(int days); // calculate result 4. The default constructor date2021( ) should set the default date of the object to be 1 January, 2021. 5. You have the freedom to add as many variables and methods as you like. You are free to select your logic until you meet the above-mentioned requirements. 6. Upload your program on LMS within the deadline and if you are unable to upload due to technical issues you can email me at [email protected] 7. In case if you are sending assignment by email then make sure that your email subject should be in the following format: “OOP Assignment 2 YOURNAME YOURSTUDENTID ”
Nov 17, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here