Question: Objectives: 1. Understand and apply top-down design concept 2. Implement the functions according to specified requirements 3. Test and debug the functions. Implement and test

Objectives: 1. Understand and apply top-down design concept 2. Implement the functions according to specified requirements 3. Test and debug the functions.

Implement and test all the functions listed in these two projects. These functions are:

_____________________________________________

#include

using namespace std;

void testMenu();

//postcondition: the test menu is displayed for choose

bool isLeapYear(int year);

int getCenturyValue(int year);

int getYearValue(int year);

int getMonthValue(int month, int year);

int dayOfWeek(int month, int day, int year);

string dayOfWeek(int day);

// precondition: day has integer value 0,1,3,4,5, or 6.

// postcondition: the name of the day of week is returned as a string.

// if day has value 0, then sunday is return; 1, then money is returned then so on.

int main()

{

int choice;

int day, month, year;

do {

testMenu();

cout << "Please choose from menu";

cin >> choice;

switch (choice)

{

case 1: // check if a given year is leap year

cout << "Please enter a year: ";

cin >> year;

if (isLeapYear(year))

cout << "Year " << year << " is a leap year" << endl;

else

cout << "Year " << year << " is NOT a leap year" << endl;

break;

case 2: //calculate the century value of a given year

cout << "Please enter a year: ";

cin >> year;

cout << "The century value is: " << getCenturyValue(year) << endl;

break;

case 3: //calculate the year value of a given year

cout << "Please enter a year: ";

cin >> year;

cout << "The year value is: " << getYearValue(year) << endl;

break;

case 4: //calculate the month value of a given month in a given year

cout << "Please enter a year and month: ";

cin >> year >> month;

cout << "The month value is: " << getMonthValue(month, year) << endl;

break;

case 5: // calculate the day of week of a given date

cout << "Please enter a year, a month, and a day: ";

cin >> year >> month >> day;

cout << "The day of the week is " << dayOfWeek(month, day, year) << endl;

break;

case 6: //print out the name of a given day of week

cout << "Please enter a day of week (0 for Sunday, 1 for Monday, etc): ";

cin >> day;

cout << "The name of the day of week is: " << dayOfWeek(day) << endl;

break;

case 7: cout << "Did you test all the functions yet? If not, please rerun the program ";

break;

default:

cout << "Wrong option. Please choose from menu ";

break;

}

system("pause");

} while (choice != 7);

}

______________________________________________________________________________________________________

For any function that the pre-condition and post-condition are missing, you should add these conditions based their understanding of the function.

Finish the implementation of all functions other than main function. Note: This project tells you a way to write functions and the code that manually test these functions.

Finish code and add function !!!!!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!