0% found this document useful (0 votes)
20 views

Assignment 1.1 Specifications

This document describes Assignment 1 for a Data Structures and Algorithms course. Students are asked to create a C++ program to analyze vaccination data from three text files provided. The program should use structures and arrays to store and manipulate the data. It should display menus to allow users to view citizen, vaccine, and vaccination records, search for a specific citizen's vaccination details, and provide statistics on vaccination rates. Correct programming techniques like comments, functions, and input validation are required. Optional bonus functionality involves additional data analysis. The goal is to help a local government with vaccination reporting and outreach.

Uploaded by

tonistack847
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Assignment 1.1 Specifications

This document describes Assignment 1 for a Data Structures and Algorithms course. Students are asked to create a C++ program to analyze vaccination data from three text files provided. The program should use structures and arrays to store and manipulate the data. It should display menus to allow users to view citizen, vaccine, and vaccination records, search for a specific citizen's vaccination details, and provide statistics on vaccination rates. Correct programming techniques like comments, functions, and input validation are required. Optional bonus functionality involves additional data analysis. The goal is to help a local government with vaccination reporting and outreach.

Uploaded by

tonistack847
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

School of Information Technology, Engineering, Mathematics and Physics

CS112: Data Structures and Algorithms


Semester 2, 2022

Assignment 1 – Using Arrays and Structures

Learning Outcome: Demonstrate the usage of various data structures in programming.

Due Date: Friday 30th September 2022 @ 11:55pm (Fiji Standard Time)

Submission: This assignment is to be done in pairs (group of two students). Submit the entire
project folder as a zip file via the Moodle Assignment 1 Drop box.

Weight: 10%

Preferred IDE: Microsoft Visual Studio 2019 – Community Edition.

1 Problem Statement
Due to the recent Covid-19 outbreak in Pacific, you have been hired as programmer by your local
government to help them with vaccination reports and analysis. The authorities has vaccination
data, vaccination registration data for individuals and the vaccination administrative data for
individuals in the system. They would like to make a program that would analyze that data to get
meaningful insights which would allow the Health Ministry to reach out to the people for
vaccination, vaccination drives, reports, and vaccination certificates for travels.

CS112 ASSIGNMENT 1 – Semester 2 2022 Page 1 of 11


2 Input files
You have been given 3 files to work with citizens.txt, vaccines.txt and
vaccination.txt. Download the file from Moodle and save it on your local computer.
Depending on the browser you are using, since this is a text file, Moodle might open the file
instead of giving you an option of saving it. Hence, to download files, you will need to copy the
entire contents of the files after it has been displayed into Moodle and saving it into Notepad
with the respective names. The files and its contents are:

1. citizens.txt – this file contains the personal details of all users. The file has 7 columns.
• c_id – citizen id is a unique identifier for an individual which identifies a citizen.
• fname – first name of the citizen.
• lname – last name of the citizen.
• gender – gender of the citizen.
• age – age of the user.
• phone – phone contact of the user.
• address – village they belong to.
• pre_con – pre health condition

2. vaccination.txt – this file contains the personal details of all users. The file has 7
columns.
• c_id – citizen id is a unique identifier for an individual which identifies a citizen.
• num_vac – this represents the number of vaccines shot the citizen is given. 1 means only
first shot, 2 means both vaccines and 3 means both vaccines with booster shot.
• V1_code – a unique identifier for vaccines for first shot/dose which is vaccine_code
in vaccine.txt.
• V1_date – timestamp in days for simplicity. This means if you have 16005789 for vaccine
one short and 16005820 for second vaccine then difference between two vaccine in days
is 16005820 – 16005789.
• V2_code – a unique identifier for vaccines for second shot/dose which is
vaccine_code in vaccine.txt. If second shot is not given, then the value is 0 for
V2_code.
• V2_date – timestamp in days for simplicity. This means if you have 16005789 for vaccine
one short and 16005820 for second vaccine then difference between two vaccine in days
is 16005820 – 16005789. If second shot is not given, then the value is 0000000 for
V2_date.
• B_code – a unique identifier for vaccines for Booster shot/dose which is vaccine_code
in vaccine.txt. If second shot is not given, then the value is 0 for B_code.

CS112 ASSIGNMENT 1 – Semester 2 2022 Page 2 of 11


• B_date – timestamp in days for simplicity. This means if you have 16005789 for vaccine
one short and 16005820 for booster vaccine then difference between two vaccine in days
is 16005820 – 16005789. If second shot is not given, then the value is 0000000 for B_date.

3. vaccine.txt – this file contains the personal details of all users. The file has 7 columns.
• vaccine_code – a unique identifier for different available vaccines.
• vaccine_name – name of the vaccine.
o Pfizer – given to children below 5 years and age greater than 60 years.
o Moderna – given to children above 5 years and age less than 17 years.
o AstraZeneca – given to citizen older than 18 years and less than 59 years.
• vaccine_minspace – this is in days. This shows the minimum number of days citizen
has to wait after getting respective vaccine after which second shot can be given.

3 Constraints
• The problem must be solved using Structures and Arrays.
• The program must work with any number of lines in the files, up to 1000. You can create
the arrays with a maximum capacity of 1000 to store the file contents.
• Do not edit the input files. The file has arbitrary number of empty lines at the end. This is
done intentionally.
• The files citizens.txt, vaccination.txt and vaccine.txt must be placed
along with your main.cpp file. That is, in the same location. The files must also be named
as citizens.txt, vaccination.txt and vaccine.txt respectively, in small
caps in your source code. Do not rename the files to any other name.

4 Requirements
This problem must be solved using structures and arrays. Create the struct for each file. In the
driver program, read the files into the respective arrays. The analysis should happen through
these arrays.
Your program should do the following:
• Read the data file and store details in Struct.
Create a menu for the user that can do the following:
1. Exit the program - the program must exit when the user enters 1.

2. Print the citizens – this function should print all citizens from citizen.txt file.
Sample Output:

CS112 ASSIGNMENT 1 – Semester 2 2022 Page 3 of 11


3. Print Vaccines – this function should print all vaccines from vaccine.txt file.
Sample output.

4. Print vaccination data – this function should print all citizen’s vaccination record.
(Hint: you have to use data from all three files) : Display Citizen ID | Full Name |
Number of Vaccines | Vaccination 1 Name | Vaccination 1 Timestamp |
Vaccination 2 Name | Vaccination 2 Timestamp | Booster Name | Booster
Timestamp | Vaccination Status (Read on different status under 4.1 specification).
You can print blanks for the Vaccination 2 Name and Date, and Booster Name and Date for
CS112 ASSIGNMENT 1 – Semester 2 2022 Page 4 of 11
partial and fully vaccinated cases. Finally print Total vaccinated (at least partial
vaccinated as shown in the sample output), percentage of each status for example: Partial
Vaccinated: 60%, Fully Vaccinated: 30%, and Fully Vaccinated with Booster:
10%. Sample output.

Explanation:
C ID is citizen ID , #Vac is number of vaccines given to the citizen. Full name comes from Citizen
data mapping user using C ID. V1, V2 and Booster name are names for the vaccines given to the
citizen. The name comes from Vaccine data mapping the vaccine code. The instance the citizen
are partial vaccinated or with 2 shots then vaccination name date dates are blanks for missing
ones. Total Vaccinated is number of citizen with at least 1 shot and percentage of total vaccinated
is percentage of citizen with at least 1 shot. Partial vaccinated percentage is percentage of
vaccinated citizen with 1 shot, Fully vaccinated percentage is percentage of vaccinated citizen
with 2 shots and Fully vaccinated with booster is percentage is percentage of vaccinated citizen
with 3 shots.

5. Search citizen using the Citizen ID - When Ministry of Health needs to give
vaccination certificate for an individual citizen, this function should allow the program user
to search and print the details of the citizen’s vaccination record. Display the Citizen ID,
Full Name, Gender, Age, Phone, Address, Number of Vaccines,
Vaccination 1 Name, Vaccination 1 Timestamp, Vaccination 2 Name,
Vaccination 2 Timestamp, Booster Name, Booster Timestamp, Vaccination
Status.

CS112 ASSIGNMENT 1 – Semester 2 2022 Page 5 of 11


Explanation:
User is prompt to enter the citizen ID: example 1003. System prints citizen detail and their
vaccination detail. Vaccination Status is based on number of vaccine shots given to the citizen as
shown in the following table:
Number of vaccines Status
1 Partially Vaccinated
2 Fully Vaccinated
3 Fully Vaccinated with Booster

• Except the first menu, all others should be implemented using functions of the main program.
• All inputs must be validated. The program must be able to handle and respond accordingly to
any input provided by the user, such as characters or letters instead of numbers.

Your program must conform to the standards of C++ programming. The expectations from this
assignment are:
• Proper comments and indentation
• Proper variable and function names
• Correct use of functions, struct and arrays
• Correct program functionality and respective output
• Proper data representation

CS112 ASSIGNMENT 1 – Semester 2 2022 Page 6 of 11


5 Bonus (2%)
This functionality is for the bonus mark to cover up any marks your group may have lost in Functionality
(1-5) under requirements. Attempt this are completing all the Functionality (1-5) under requirements.
Note: 2% won’t be added to 10% to make it 12% but if you scored 8% and completed this functionality
then your total will be 8+2=10%. Maximum percentage from the assignment will still be 10% only.

This will be functionality 6 in the menu list.

6. Print Recommendation – based on the citizen’s vaccination records this function should
display the recommendation/comments which includes: Citizen ID | Full Name |
Number of Vaccines | Vaccination Status | Recommendation (Read on different
recommendation under 5.1 specification).

5.1 Specification
Based on the vaccination record of an individual the recommendation is given for the individual. This
recommendation is based on age and number of days after second shot was given. Only work on the
following scenarios and recommendation as shown below:

Case Condition 1 Vaccination Status Recommendation


1 Age below 5 or over 60 years Partial vaccinated and Number of N number of days left for
over (including 5 and 60) days from 1st vaccine is less than second shot.
vaccine_minspace Eg: 5 days left for second shot.
Hint: N = C - V1_date
2 Age below 5 or over 60 years Partial vaccinated and Number of Ready for second vaccine:
over (including 5 and 60) days from 1st vaccine is more than Pfizer
vaccine_minspace
3 Age below 5 or over 60 years Fully Vaccinated Fully Vaccinated. Booster is
over (including 5 and 60) not needed.

CS112 ASSIGNMENT 1 – Semester 2 2022 Page 7 of 11


4 Age above 6 years and below 17 Partial vaccinated and Number of N number of days left for
years over (including 6 and 17) days from 1st vaccine is less than second shot.
vaccine_minspace Eg: 5 days left for second shot.
Hint: N = C - V1_date
5 Age above 6 years and below 17 Partial vaccinated and Number of Ready for second vaccine:
years over (including 6 and 17) days from 1st vaccine is more than Moderna
vaccine_minspace
6 Age above 6 years and below 17 Fully Vaccinated and Number of N number of days left for
years over (including 6 and 17) days between 1st and 2nd vaccine Booster shot.
is less than vaccine_minspace Eg: 5 days left for booster
shot.
Hint: N = V2_date - V1_date
7 Age above 6 years and below 17 Fully Vaccinated and Number of Ready for Booster vaccine:
years over (including 6 and 17) days between 1st and 2nd vaccine Pfizer
is more vaccine_minspace
8 Age above 6 years and below 17 Fully Vaccinated with Booster Fully Vaccinated with Booster
years over (including 6 and 17)
9 Age above 18 years and below Partial vaccinated and Number of N number of days left for
59 years over (including 18 and days from 1st vaccine is less than Booster shot.
59) vaccine_minspace Eg: 5 days left for second shot.
Hint: N = V2_date - V1_date
10 Age above 18 years and below Partial vaccinated and Number of Ready for second vaccine:
59 years over (including 18 and days from 1st vaccine is more than AstraZeneca
59) vaccine_minspace
11 Age above 18 years and below Fully Vaccinated and Number of N number of days left for
59 years over (including 18 and days between 1st and 2nd vaccine Booster shot.
59) is less than vaccine_minspace Eg: 5 days left for booster
shot.
Hint: N = V2_date - V1_date
12 Age above 18 years and below Fully Vaccinated and Number of Ready for Booster vaccine:
59 years over (including 18 and days between 1st and 2nd vaccine Pfizer
59) is more than vaccine_minspace

5.1.1 Keynotes and Hints for Recommendation


For simplicity, the following is applied:
o C is current timestamp and for this assignment use which is: 16793183
o For age below 5 or over 60 years over (including 5 and 60) – only Pfizer_2.0 vaccine for
first and second shot is given.
o Age above 6 years and below 17 years over (including 6 and 17) - only Moderna1.0
Vaccine is given for first and second shot is given.

CS112 ASSIGNMENT 1 – Semester 2 2022 Page 8 of 11


o Age above 17 years and below 59 years over (including 17 and 59) - only AstraZeneca
vaccine is given for first and second shot is given.

6 Submission Guidelines
1. Go to the location where your project is saved.
2. Zip the entire project folder. Do not zip or submit the individual file/files such as main.cpp
or any executable file. You must zip the entire folder.
3. Rename the zipped file with the student IDs of both the group members. Example:
sXXXXXXXX_sXXXXXXXX.zip. X’s represents the ID numbers of the student ID.
4. After renaming, submit the single zipped file in the Assignment 1 Dropbox on Moodle.
5. After submitting, download your submission on your computer, unzip and open with
Microsoft Visual Studio to ensure it opens successfully and you’re able to compile and run
it.

All submission must be made through the correct dropbox. Do not submit any assignment via
email. Late assignments will not be accepted. Please note there will be no due date extension
until prior approval has been taken.

LATE ASSIGNMENTS WILL NOT BE ACCEPTED.

Plagiarism
Any kind of plagiarism or cheating like submission of work that is not your own will lead to a ZERO
(0) score AND you will be subject to disciplinary action. Discussing is permitted however you must
avoid giving your working copy or the final assignment file to anyone. This increases the risk of
your assignment being cited as a plagiarized work.
ALL plagiarized assignments will receive a mark of ZERO and will be referred to the Disciplinary
Committee.

Assignment Clarification
It is expected that students will seek clarifications regarding this assignment. For any such
clarification, you may post a message on Moodle Discussion Forums under the Assignment 1
Discussions Topic only. Any message relating to the Assignment placed under a different topic
WILL NOT be looked at or answered.

At the same time, please note that you are not allowed to share/discuss your Assignment on
these forums. Students must refrain from placing their assignments on the discussion forum.
Students found doing this will be referred to the Disciplinary Committee and will also be awarded
a mark of ZERO.

CS112 ASSIGNMENT 1 – Semester 2 2022 Page 9 of 11


Assignment 1 Assessment Rubric

CBOK Beyond expectation [0% - Meet expectation [50% - 75%] Below Satisfactory [76% - 100%] Score
49%]
Programming All satisfactory and I. Able to write a simple code for a well- I. Code has compile/run/logic 20
demonstrate very good defined problem errors.
programming skills. II. Use of basic standard programming Poorly written code.
practices such as commenting, II. Plagiarism
indentation etc. III. Poor indentation, hard to read
III. computer program produces correct and follow the code
output IV. Lots of bugs and/or errors
V. Program produces unexpected
output
VI. In appropriate use of variables
and parameters.
VII. No input validation
VIII. Hard coding of data in the
program.
IX. Program is not well structured.

CS112 ASSIGNMENT 1 – Semester 2 2022 Page 10 of 11


Functions Beyond expectation [0% - 49%] Meet expectation [50% - 75%] Below Satisfactory [76% - 100%] Score

Function 2: Print Function declaration, Function declaration with partial Only function declaration. Rubric: I 10
the Citizens implementation and call. Function implementation. Rubric: I - III - IX
displays correct output. Rubric: I

Function 3: Print Function declaration, Function declaration with partial Only function declaration. Rubric: I 10
Vaccines implementation and call. Function implementation. Rubric: I - III - IX
displays correct output. Rubric: I

Function 4: Print Function declaration, Function declaration with partial Only function declaration. Rubric: I 30
Vaccination data implementation and call. Function implementation. Rubric: I - III - IX
displays correct output. Rubric: I
Function 5: Function declaration, Function declaration with partial Only function declaration. Rubric: I 30
Search citizen implementation and call. Function implementation. Rubric: I - III - IX
using the Citizen displays correct output. Rubric: I
ID
Bonus (2%) – marked separately
Function 6: Print Function declaration, Function declaration with partial Only function declaration. Rubric: I 20
Recommendation implementation and call. Function implementation. Rubric: I - III - IX
displays correct output. Rubric: I

CS112 ASSIGNMENT 1 – Semester 2 2022 Page 11 of 11

You might also like