Write a program to help schedule appointments for a doctor, and write a test plan to test your program.

Your program should be modular, meaning that it will be written using a minimum of FIVE user-defined functions (not including main). All functions (other than main) should be prototyped.

This program will incorporate re-use of code. You will incorporate the week 4 program 2 code into this program as a function. The function will be written as follows:

  • The user will still identify the day by entering the first few letters, exactly as they did for the original program.
  • Then, instead of displaying the day name, the code should be modified to assign a "day string" variable the correct day and return that string to the calling function.
  • If the user enters an invalid day, the function should issue an error message and loop, until a valid day is entered.
  • Write the code so that there is only ONE return statement in the function, which returns a valid day string.

Program Execution

Your program should first read in three values from the user, representing the current date (day, week, and month). The date will be represented as the "Xth Dayname of Monthname".

Example: The "3rd Monday of December"

  • Read in the current day (using your modified "day reading" function, described above).
  • Read in the current week (1-4) and the current month number (1-12), using two separate calls to an "integer reading" function, described below.
    • The "integer reading" function should have three input parameters: a prompt string, a low limit, and a high limit
    • The string parameter should be used to prompt the user for input, and the low and high limit parameters should be used to error check that the value entered by the user is valid.
    • The function should loop until the user enters a valid integer, between low and high, inclusive. If an invalid value is entered, the function should issue an error message, and loop to prompt and read another value.
    • When calling the "integer reading" function to read the current week number, use 1 and 4 as the low and high limits.
    • When calling the "integer reading" function to read the current month number, use 1 and 12 as the low and high limits.

The values for the current day, week, and month should be read from the user only ONCE (not every time the program loops to run another patient).

Sample current date input:

Enter first letter of the current day of the week: T

Enter the second letter: h

Enter the current month number (1-12): 11

Enter the current week within the month (1-4): 2

Then, for each patient:

  • Call a getInput function to read all patient data. Within getInput, read in the patient's first name and then the patient's last name. No error checking is required.
    • However, since first and last names may contain spaces, you will need to use the getline function to read them. Also within getInput, read number of weeks until the doctor wants to see the patient again.
    • Call the same "integer reading" function you already wrote to read in the current numbers.
    • When calling the "integer reading" function to read the number of weeks, use 2 and 52 as the low and high limits.
  • Return all input from getInput to main, via reference parameters.
  • Calculate the follow-up visit date as follows: To calculate the follow-up month and week, assume four weeks per month (even if there are actually more or less in a given month). The follow-up will occur on the same day as the current day.
  • Finally, output the results to the user as specified below ( Note: the logic for this section can be tricky – be sure to take ALL possible cases into consideration).
    • Neatly output the patient's name, the current "date", and the "date" of the follow-up visit. The months should be displayed in WORDS, not numbers. Use a separate function to convert from month number to month word See sample output below for example.

Your program should loop and process patients for the same current date, until the user indicates that s/he is done.

Sample Input/Output for one patient:

Enter patient first name: Joe
Enter patient last name: Smythe

Enter number of weeks until the follow-up visit: 5

RESULTS:

Patient: Smythe, Joe

Current Date: 2nd Thursday of November

Follow-up Date: 5 weeks from now
3rd Thursday of December


Determine follow-up date for another patient (y/n)? y

Sample Input/Output for another patient:

Enter patient first name: Mary Ellen
Enter patient last name: Van Horn

Enter number of weeks until the follow-up visit: 11

RESULTS:

Patient: Van Horn, Mary Ellen

Current Date: 2nd Thursday of November

Follow-up Date: 11 weeks from now
1st Thursday of February


Determine follow-up date for another patient (y/n)? N
Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.