Problem Statement Due to the recent Covid-19 outbreak in Fiji, you have been hired as programmer by your local governmen
Posted: Sat Nov 27, 2021 2:38 pm
Statement Due to the recent Covid-19 outbreak in Fiji, you have been hired as programmer by your local government to help them trace the possible contacts. They have gathered the necessary data using their contact tracing app and 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 possible contacts and provide necessary medical help. You have delivered version 1 & 2 of the program (in Assignment 1 & 2 respectively) to the health Ministry however, they have found some performance issues and they would also like to make some enhancements to the program. Input files You have been given 2 files to work with, contacts.txt and users.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 contents of the files after has been displayed into Moodle and saving it into Notepad with the respective names. The files and its contents are as follows:
. . . 1. contacts.txt – this file contains the details gathered by the contact tracing app. You are given two files with the name contacts.txt. Use the file with fewer number of lines to make your program. The other file has a lot more number of lines. This file can be used to test your code once you have finished making the program to ensure your program works perfectly. The file has 5 columns, as follows: user_id - a unique identifier for an individual which identifies a contact tracing app user. contact with unique identifier of another user whom an individual came in contact with. contact_start - date and time of when the individuals came into contact. The date and time is in the timestamp format. contact_end - date and time of when the individuals went out of contact. The date and time is in the timestamp format. distance(cm) - distance between the individuals while they were in proximity. The distance is in centimeters. 2. users.txt – this file contains the personal details of all users. The file has 7 columns. user_id - a unique identifier for an individual which identifies a contact tracing app user. fname - first name of the user. lname - last name of the user. gender - gender of the user. age - age of the user. phone - phone contact of the user. address - village they belong to. . . . . .
Constraints The problem must be solved using Linked Lists (either singly or doubly. Recommended to use doubly linked list). ► The program must work with any number of lines in the files. ► Do not edit the input files. The file has arbitrary number of empty lines at the end. This is done intentionally. ► The files contacts.txt and users.txt must be placed along with your main.cpp file. That is, in the same location. The files must also be named as contacts.txt and users.txt respectively, in small caps in your source code. Do not rename the files to any other name.
Requirements The program must print a welcome message to the user of the program and then display 6 menus items to choose from. All menu items must be implemented as functions. The program must have 6 menu items, as follows: 1. Exit the program – the program must exit when the user enters 1. 2. Print the users - this function should print all the users from the users.txt file. Display all the columns. Sample output: Enter your option (1-5): 2 UserID Fname Lname Gender Age Phone Address 1001 Ray Dixon 1002 Bryan Green 1003 Justin Dixon 1004 Lester Byrd 1005 Santos Larson 1006 Bryan Cobb 1007 Eddie Watson 1008 Wesley Barton 1009 Victor Mason 1010 Ellis Cobb 1011 Diana Ross 1012 Amanda Carter 1013 Maria Edwards 1014 Maria Jenkins 1015 Louise Davis 1016 Sandra Sanders 1017 Bonnie Roberts 1018 Melissa Harris 1019 Marilyn Parker 1020 Bonnie Lopez Total users: 20 M M M M M M M M M M F F F F F F F F F F 46 18 33 45 53 42 20 27 50 24 27 43 53 34 55 29 40 29 56 43 9364652 9579302 9353533 9534695 9093177 9905139 9610408 9801864 9855386 9389406 9940148 9506743 9798534 9352516 9812126 9369570 9689234 9321235 9409221 9342939 Lokia Drekena Lokia Nasilai Vunuku Narocivo Nabua Nasigatoka Nukutubu Narocivo Vunuku Nasilai Narocivo Lomanikoro Nasilai Tavuya Nukui Drekena Nukui Nasigatoka
4. Print the contacts who came into contact' – this function should filter out and print only those contacts who "came into contact”. Two individuals are said to have come into contact if: a. They have been in proximity for more than or equal to 15 seconds, or, b. The distance between the two was less than 100cm, regardless of the contact duration. Display the user_id, contact_with, duration in seconds, distance in cm. Sample output: Enter your option (1-5): 4 UserID Con/With Duration(s) Distance(cm) 1003 1010 498 1020 1012 408 1010 1018 143 1020 1011 391 1005 1011 4 Total contacts: 5/10 309 119 217 42 68 Explanation: Lines 1, 2, and 3 (1003 with 1010, 1020 with 1012, 1010 with 1018, respectively) are filtered because they have been exposed for 498, 408 and 143 seconds respectively. Line 4 is filtered because the duration is more than 15 seconds and the distance is also less than 100cm. Line 5 is filtered because, even though they were not in contact for long but they came very close to each other with a distance between them of 68cm.
5. Search by userID - after the contacts have been identified, the Health Ministry would like to reach the individuals to provide necessary medical care. This function should allow the program user to search and print the details of the contacts. Display the user_id, full name, gender, age, phone, address. Sample output: Enter your option (1-5): 5 Enter the user ID to search: 1003 UserID: 1003 Name: Justin Dixon Gender: Male Age: 33 Phone: 9353533 Address: Lokia 6. Print the users in reverse - this function should print all the users from the users.txt file, but in reverse order. Display all the columns. (Result will be same as option 2 but printed in reverse ie. 1020 will be printed first and 1001 will be last). Testing your code ► You were given two files with the name contacts.txt. The file has different number of lines of. Use both the files to test your code to ensure it works perfectly. ► 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.
Program hints Write all code in a single main.cpp file. You will have 2 linked lists in the program (one to store user details, one for contacts). Use the A1 exe file from moodle should you need to compare the program output.
Problem . . . 1. contacts.txt – this file contains the details gathered by the contact tracing app. You are given two files with the name contacts.txt. Use the file with fewer number of lines to make your program. The other file has a lot more number of lines. This file can be used to test your code once you have finished making the program to ensure your program works perfectly. The file has 5 columns, as follows: user_id - a unique identifier for an individual which identifies a contact tracing app user. contact with unique identifier of another user whom an individual came in contact with. contact_start - date and time of when the individuals came into contact. The date and time is in the timestamp format. contact_end - date and time of when the individuals went out of contact. The date and time is in the timestamp format. distance(cm) - distance between the individuals while they were in proximity. The distance is in centimeters. 2. users.txt – this file contains the personal details of all users. The file has 7 columns. user_id - a unique identifier for an individual which identifies a contact tracing app user. fname - first name of the user. lname - last name of the user. gender - gender of the user. age - age of the user. phone - phone contact of the user. address - village they belong to. . . . . .
Constraints The problem must be solved using Linked Lists (either singly or doubly. Recommended to use doubly linked list). ► The program must work with any number of lines in the files. ► Do not edit the input files. The file has arbitrary number of empty lines at the end. This is done intentionally. ► The files contacts.txt and users.txt must be placed along with your main.cpp file. That is, in the same location. The files must also be named as contacts.txt and users.txt respectively, in small caps in your source code. Do not rename the files to any other name.
Requirements The program must print a welcome message to the user of the program and then display 6 menus items to choose from. All menu items must be implemented as functions. The program must have 6 menu items, as follows: 1. Exit the program – the program must exit when the user enters 1. 2. Print the users - this function should print all the users from the users.txt file. Display all the columns. Sample output: Enter your option (1-5): 2 UserID Fname Lname Gender Age Phone Address 1001 Ray Dixon 1002 Bryan Green 1003 Justin Dixon 1004 Lester Byrd 1005 Santos Larson 1006 Bryan Cobb 1007 Eddie Watson 1008 Wesley Barton 1009 Victor Mason 1010 Ellis Cobb 1011 Diana Ross 1012 Amanda Carter 1013 Maria Edwards 1014 Maria Jenkins 1015 Louise Davis 1016 Sandra Sanders 1017 Bonnie Roberts 1018 Melissa Harris 1019 Marilyn Parker 1020 Bonnie Lopez Total users: 20 M M M M M M M M M M F F F F F F F F F F 46 18 33 45 53 42 20 27 50 24 27 43 53 34 55 29 40 29 56 43 9364652 9579302 9353533 9534695 9093177 9905139 9610408 9801864 9855386 9389406 9940148 9506743 9798534 9352516 9812126 9369570 9689234 9321235 9409221 9342939 Lokia Drekena Lokia Nasilai Vunuku Narocivo Nabua Nasigatoka Nukutubu Narocivo Vunuku Nasilai Narocivo Lomanikoro Nasilai Tavuya Nukui Drekena Nukui Nasigatoka
4. Print the contacts who came into contact' – this function should filter out and print only those contacts who "came into contact”. Two individuals are said to have come into contact if: a. They have been in proximity for more than or equal to 15 seconds, or, b. The distance between the two was less than 100cm, regardless of the contact duration. Display the user_id, contact_with, duration in seconds, distance in cm. Sample output: Enter your option (1-5): 4 UserID Con/With Duration(s) Distance(cm) 1003 1010 498 1020 1012 408 1010 1018 143 1020 1011 391 1005 1011 4 Total contacts: 5/10 309 119 217 42 68 Explanation: Lines 1, 2, and 3 (1003 with 1010, 1020 with 1012, 1010 with 1018, respectively) are filtered because they have been exposed for 498, 408 and 143 seconds respectively. Line 4 is filtered because the duration is more than 15 seconds and the distance is also less than 100cm. Line 5 is filtered because, even though they were not in contact for long but they came very close to each other with a distance between them of 68cm.
5. Search by userID - after the contacts have been identified, the Health Ministry would like to reach the individuals to provide necessary medical care. This function should allow the program user to search and print the details of the contacts. Display the user_id, full name, gender, age, phone, address. Sample output: Enter your option (1-5): 5 Enter the user ID to search: 1003 UserID: 1003 Name: Justin Dixon Gender: Male Age: 33 Phone: 9353533 Address: Lokia 6. Print the users in reverse - this function should print all the users from the users.txt file, but in reverse order. Display all the columns. (Result will be same as option 2 but printed in reverse ie. 1020 will be printed first and 1001 will be last). Testing your code ► You were given two files with the name contacts.txt. The file has different number of lines of. Use both the files to test your code to ensure it works perfectly. ► 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.
Program hints Write all code in a single main.cpp file. You will have 2 linked lists in the program (one to store user details, one for contacts). Use the A1 exe file from moodle should you need to compare the program output.