Reference no: EM133142605
CSC5020 - Foundations of Programming Assignment - University of Southern Queensland
Goals and Topics - The assignment problem is straightforward. All necessary details have been supplied. The solution to the problem will use the programming concepts and strategies covered in workshops
1-10 delivered in the course. The subgoals are:
-Obtaining an advanced understanding of values, variables and lists;
-Understanding program input and output, functions and expressions;
-Understanding simple strategies like iteration, validation, sum and count;
-Understanding of advanced strategies like swapping, sorting, tallying and searching;
-Translating simple design into Python code;
-The mechanics of editing, interpreting, building and running a program;
-Testing a program;
-Commenting source code, especially Docstring on functions;
-Becoming confident and comfortable with programming in small problems.
The Task - In this assignment, you are required to design, implement and test a program that can be used to manage a simple personal Schedule with appointment records, which are stored in a list.
Your program must provide an interactive design that allows the user to:
-create new appointment records and add them to the Schedule;
-display all appointment records with details;
-sort all appointments based on an attribute;
-search for specific appointment records in all records based on an attribute.
The program is to be implemented by Python and as a .ipynb file running on Jupyter notebook.
Your Tasks - It is strongly suggested that the following approach is to be taken to design and implement the program.
Five Input Functions
You should first design, implement and test the input functions of Schedule. You need to create 5 input functions (refer to Figure 1). For example, the second input function is applied to enter the date with the hint "Please enter the date of your new appointment, e.g. 25/9/2022". You are welcome to design your 5 input functions and IDE, as long as they can input the priority, date, start time, end time and subject of the new appointments similar to the sample IDE shown in Fig. 1. The 5 inputs for each appointment record will be stored as a string (record) in the appointmentList.
All the functions except built-in functions should be presented with proper Docstrings.
The addRecord() Function
You should design, implement and test a function which adds an appointment record to the Schedule. An appointment record will be added to the Schedule each time when the 5 inputs of the appointment record are all valid. If any input is invalid, display an error message and ask user for another input. The function handles the following tasks:
-Collect all data (priority, date, start time, end time and subject) for the appointment record (assigned them to a string as "High;23/9/2022; 9; 10; CSC1401 class", other formats for the string are not acceptable for this assignment);
-Validate if the input for "Date" is correct regarding the specification in the Date section by using the function isValidDate() described below;
-Validate if the input for "Time" is correct regarding the specification in the Time section by using the isValidTime() described below;
-A non-empty string within 30 characters (including space between words) for the subject.
-"Low" and "High" are the only two valid inputs of priority, case insensitive.
-Call isConcurrentAppointment() first then add the valid appointment record into the appointmentList list if all data are valid;
-The program will repeatedly ask users to input the record until "END" is input for the date. Call showRecords() to present the table of all the records.
The showRecords() Function
You should design, implement and test a function to print all existing records in a "table" as the Figure 2 after the task of Input Functions is completed. The function should access the appointmentList and print all existing appointment records (no requirement about the order) in the table.
-a "table" including headers, "--" which separate the header from the content of each record.
-The number of "-" is equal to the maximum number of text or the length of the header for each column.
-Indentation is appropriate as shown in Figure 2.
You could create some dummy appointment records manually and store them in the appointmentList to test this function, while other functions still remain incomplete.
The isValidDate() Function
You should design, implement and test a function to validate the data input for the Date attribute of an appointment record. The function should alert an error message and return false if the input is invalid, otherwise, return true.
-Refer to the Date section for what the function needs to check for validation.
-To evaluate students' string handling capabilities, only the "25/9/2022" date format is a valid input format for 25th September 2022. Use of built-in functions or some libraries to input valid date is not acceptable for this assignment.
-You can revise the date validation code in your assignment1 for this function.
The isValidTime() Function
You should design, implement and test a function to validate the time input for the start time and end time attributes of an appointment record. The function should alert an error message and return false if the input is invalid, otherwise, return true. Refer to the Time section for what the function needs to check for validation.
The isConcurrentAppointment() Function (Challenge task)
You should design, implement and test a function to validate if the input data for the Date, Start Time and End Time of an appointment is concurrent to any existing appointments in the appointmentList. The time of two appointments is considered concurrent if the time span for the two appointments overlap each other in full or in part. Note that an appointment can start at a time when another finishes, or vice versa. An appointment starts and finishes on the same day.
The function should alert an error message and return true if the input appointment is concurrent with any existing appointments in appointmentList, otherwise, return false.
The sortRecords() Function
You should design, implement and test a function to allow the user to sort all appointment records in appointmentList based on Priority, and then display the sorted appointment records of Schedule when the user enters the corresponding keyword. The program will repeatedly ask users to input the keyword (e.g. the hints "Do you want to sort the appointments by priority, Yes or No". Only "Yes", "No" are valid inputs, case insensitive) until "No" is entered to stop the iteration.
You should use the following suggestions as the guideline:
Priority: "High" to "Low" (For the "High" or "Low" groups of records, no requirement about the order if the priorities of records are the same);
You should use string handling techniques to extract the corresponding attribute values from the appointment records and sort the appointment records based on these values. The outcome should be similar to Figure 3.
The tallyRecords() Function
You should design, implement and test a function to calculate the number of appointments based on one of the two attributes: 1.date, 2.priority and display the total number of appointment records of Schedule when the user enters the corresponding keyword. The program will continuously ask users to input the attribute (e.g. the hints "Do you want to tally the appointments by date, priority or year". Only "date", "priority", "year" and "END" are valid inputs, case sensitive) until "END" is entered to stop the iteration.
You should use the following suggestions as the guideline:
a) Summary by date:
You can use different methods to achieve the goal. One option is as follows:
-Find all different dates in the appointmentList.
-For each date, count how many times it appears in the second part of the records.
b) Summary by priority:
-Find the appointments with different priorities by using a string search plan.
-Count how many records with "High" and "Low" priorities and show the number by printing a table as Figure 4.
c) Summary by year:
You can use different methods to achieve the goal. One option is as follows:
-Find all different years in the appointmentList.
-For each year, count how many times it appears in the second part of the records.
You have to list the results following a specific order of date (from an earlier date to a later date or from High to Low or from an earlier year to a later year).
The searchRecords() Function
You should design, implement and test a function to search the appointment records using the keywords given by the user. The program will repeatedly ask users to input the attribute (e.g. the hints "Do you want to search the appointments by date or subject". Only "date", "subject" and "END" are valid inputs, case insensitive). Once the valid attribute is obtained from users, the program will ask users to input the search keywords (e.g. the hints "Please enter the keyword for searching"). The requirements are as follows:
-The keywords for searchRecord() Function are case insensitive. That means no matter the users search "Class" or "class", the program will show all the records including "class".
Two examples: 1. Once the users search "a" by "subject", any record with subject including the character "a" will be displayed no matter the "a" is in "class" or "party".
2. Once the users search "1" by "date", any record with a date including the number "1" will be displayed. Note that "1" can be the value for day, month or year. However, "11" of the day, month or year and "1" in the subject do not count. That means if you search the "5" or "20" by date, the record with the date "25/9/2022" won't be presented in the output.
The program has to list the search results as Figure 5. There is no requirement about the order of display. Then ask users to input the attribute of searching again until "END" is entered to stop the iteration.
Program Integration Test
You need to test the program for all functionality thoroughly before delivering the program to clients. The program should be running appropriately without any syntax or logic errors.
Attachment:- Foundations of Programming Assignment File.rar