C++ hwork

C++ hwork

Make sure to properly format and document all code!

Problem 1

Write a program that prompts the user to enter the weekday the year started on and the current day of the year (i.e., 200
for the 20oth day of this year). The program should output the name of the current weekday in English and German, how
many days until the weekend (Saturday), and how many days until the start of the next work week (Monday).

To create this problem do the following.

1. Create an enum type named Weekday (with a capital W) that has the values listed in the table below.

2. Write a function named yea rDayToWeek that takes two parameters: (1) a Weekday representing the first weekday
of the year and (2) the number of days it has been since January 1“. The function should return a Weekday enum
value that the current weekday, based on the parameter values.

Hint: remember that the modulus operator finds the remained of division. If you divide a number of days into 7-
day weeks, the remaining days would be how many days you are into the last week. Supposing the start day of
the year is a Tuesday (numeric value of 2) and it is the third day of the year, then if we count the 3 days (Tuesday,
Wednesday, Thursday), the function should return THURSDAY (numeric value of 4 = 2 + 3 – 1). Similarly if it is the
fourth day of the year, then the function should return FRIDAY (numeric value of 5 = 2 + 4 – 1). We subtract 1,
because you don’t otherwise we count the start day twice. With this relationship, you can calculate the current
weekday using the formula (sta rtDay + numbe rOfDays – 1) 9s 7. We use a the remainder after dividing by
7 because there are 7 days in a week.

3. Write a function named daysUntiI, that takes as parameters two Weekday enum values. The function should
return then number of days from the first Weekday until the second Weekday. This should never be a negative
number.

4. Write two functions named wee kdayInEnlish and weekdayInGerman. Both functions should accept a Weekday
enum value and return the name of the weekday in the respective language as a string. See the table below. Use a
switch statement in both of these functions to return the appropriate string value.

Enum Value Day of Week Integer Value English Name German Name
SUNDAY 1 0 Sunday Sonntag
MONDAY 2 1 Monday Montag
TUESDAY 3 2 Tuesday Dienstag
WEDNESDAY 4 3 Wednesday Mittwoch
THURSDAY 5 4 Thursday Donnerstag
FRIDAY 6 5 Ffiday lfienag
SATURDAY 7 6 Saturday Samstag
INVALID_DAY 7 Invamjday IJnguMgerTag
Sample Output (user input is in yellow)

What weekday did January 1st land on?

Enter a number between 1 (Sunday) and 7 (Saturday): 1

This year started on a Sunday.

Enter the current day in of the year (e.g., 180): 59

Today is Tuesday in English and Dienstag in German.

This is day 3 of the week.

The weekend is in 4 days.

The next work week is in 6 days.

Sample Output (user input is in yellow)

What weekday did January 1st land on?

Enter a number between 1 (Sunday) and 7 (Saturday): 3

This year started on a Tuesday.

Enter the current day in of the year (e.g., 180): 200

Today is Friday in English and Freitag in German.

This is day 6 of the week.

The weekend is in 1 days.

The next work week is in 3 days.

Order from us and get better grades. We are the service you have been looking for.