代做COMP 218 Fundamentals of Object-Oriented Programming Assignment 2代做C/C++程序
- 首页 >> Algorithm 算法COMP 218 Fundamentals of Object-Oriented Programming
Assignment 2
Late submission: Please note that late submissions will not be accepted. I encourage you to take advantage of Tutorials, PODs and TAs support to ensure your timely and successful completion of the assignment.
Purpose: The purpose of this assignment is to have you experience the basic steps
involved in writing a complete C++ program (from algorithm development to coding) and to practice with string data type variables, selection
statements and the while repetition statement.
Please note: you are NOT allowed to post the assignment/solution anywhere on the
Internet. Intellectual Property rights are reserved. If any similar cases are found via your
account or IP, your submission will NOT be considered and will be reported immediately.
General Guidelines When Writing Programs:
Same as for assignment #1 – Refer to assignment #1 handout for details.
RECOMMENDATION for this assignment:
Take the time to write out an algorithm for these problems to help clarify the logic BEFORE you start programming. (No need to hand in the algorithm.)
Question #1: Covid Vaccine Program (6 pts)
In this question, you are asked to write a program to understand natural language. The user will enter the input following the format:
FirstName_LastName@Number1#Number2
For example:
Robin_Moring@1#2
Assume a perfect user will follow the exactly above formats for the inputs. Your program should be able to analyze the key words (Name, Number1 and Number2) from the
inputs and display the outputs in the following format. You must use if-else statement to display the correct place.
LastName, FirstName has completed Number2 dose(s) of Covid 19 vaccine at
Place*.
If the Number2 is less than 3, your program should also display the following message: Please complete the remaining N** dose(s) soon. Take care!
If the Number1 is not listed in the table or Not Available, your program should ask user for a new input.
** N = 3 – Number2
* Here is a list of Place that your program should display according to the input
Number1.
Number1 |
Place |
Number1 |
Place |
1 |
Pharmacy |
5 |
Health Center |
2 |
Jean Coutu |
6 |
Pharmacy |
3 |
Olympic Stadium |
7 |
Jean Coutu |
4 |
Uniprix Clinique |
8 |
Not Available |
Hints: You may use string functions: at(), length(), substr(), stoi(), find() to solve this question.
Your program should be able to ask user for new input of user’s information for
estimation until get the input Yes from the user. Following are sample screen shot to
Please note: Your program must display the same information but the output can be formatted differently.
Figure 1 The output Example 1 of Question1
Figure 2 The output Example 2 of Question1
Question #2: Covid Vaccine Appointment Program (8pts)
In this question, you will write a program to help the resident book Covid vaccine program. Here are the detail requirements that your program should follow:
If you completed 3 doses, you do not need to book any appointments.
If you completed less than 3 doses, you need to book the appointment based the user’s entered age.
Here is a list of age, possible appointment starting dates, locations, and schedules. You must use switch statement to find and display the correct location and schedule.
Age |
Starting Date |
Location |
Schedule |
55 or above |
Jan. 4 |
− Pharmacy − Jean Coutu − Olympic Stadium − Uniprix − Health Center |
− 10:00 – 10:15 AM − 10:30 – 10:45 AM − 11:15 – 11:30 AM − 13:30 – 13:45 PM − 15:00 – 15:15 PM |
50-54 |
Jan. 6, |
||
40-49 |
Jan. 12, |
||
30-39 |
Jan. 17, |
||
20-29 |
Jan. 19 |
||
18 or above |
Jan. 21 |
||
Under 18 |
N/A |
N/A |
N/A |
The program prompts the user to the choice based on the above table and validates the information according to the following rules:
− If the user’s entered age is not in the above range, ask the user enter again until receiving a valid input.
− Your program should check user’s entered number of locations and schedules. If it is not in the list, ask the user enter again.
− Display the complete appointment info if it is booked successfully.
− Display welcome/closing messages.
If the user give an invalid input of choice, your program should output message and ask user for a new one until a valid input is given.
Please note your program must display the same information but the output can be formatted differently.
Figure 3 The output Example 1 of Question2
Figure 4 The output Example 2 of Question2
Submitting Assignment 2
− Zip together the source codes (.cpp files only) for questions 1 and 2.
− Naming conventin for zip file:
Create one zip file, containing all source files for your assignment using the following naming convention:
The zip file should be called a#_studentID, where # is the number of the assignment studentID is your student ID number. For example, for this 2nd assignment, student 123456 would submit a zip file named a2_13245.zip
− Submit only ONE version of an assignment. If more than one version is submitted the first one will be graded and all others will be disregarded.
Note:
− Late assignments will be discounted by 25%. Late assignments are accepted up to five days late (grace period) and weekends count.
− Assignments not submitted in requested format may not be graded.
− Uploading incorrect files will result in grade of 0.
Evaluation Criteria for Assignment 2 (20 points)
For Assignment 2 – 6 pts. |
|
Comments – description of variables/ description of the steps in code/ purpose of program |
2 pts. |
Choice of variable names |
1 pt. |
Indentation and readability of program |
1 pt. |
Welcome and closing message |
1 pt. |
Clear prompts to user & clear messages with output results |
1 pt. |
Question 1 – 6 pts. |
|
Prompting user & reading data |
1 pt. |
Determine the key words in the sentence |
3 pts. |
Find the correct place use if-else statement |
1 pt. |
Display results |
1 pt. |
Question 2 – 8 pts. |
|
Ask for & read data |
2 pts. |
Validate all the input info |
1 pt. |
Find and display the correct date |
1 pt. |
Find and display the correct location and schedule use switch statement |
2 pts. |
Display the results |
2 pts. |