CSC5020 Foundations of Programming Assignment

Assignment Help Programming Languages
Reference no: EM133137597

CSC5020 Foundations of Programming - 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.

Schedule
Figure 1 illustrates the Schedule with an interactive editing environment on a webpage. Please use this illustration as the reference for the following descriptions. It is not necessary for you to present the interactive environment exactly as the Figure 1. Use 5 input functions to input the appointment record information. The records can be displayed using a table with headers and "--" as Figure 2. Figure 3 shows appointment records sorted by "Priority". Figure 4 shows the examples of the tallying results. Figure 5 shows appointment records with "Subject" contains letter "a".

Appointment records
An appointment record in this program will hold or encapsulate data for the date, start time, end time, subject and priority of the appointment. In respect to each of the attributes, an appointment record can be represented like the following sample:
" High;23/9/2022; 9; 10; CSC1401 class"

This can be deciphered as the appointment with "High" priority, on the date of "23/9/2022", starting at "9:00 am" and finishing at "10:00 am", about the subject of "CSC1401 class". You should create a global variable "list" to store all such appointments. For the sake of easy explanation, we refer to this variable by appointmentList in the rest of this document.

There are some limitations that must be imposed on the appointment records:
1. The start and end time in an appointment record indicates the hour;
2. An appointment starts and finishes on the same day;
3. Only appointments occurring at a future time can be added to the Schedule;
4. No concurrent or overlapping appointments are to be added to the Schedule.

Date
A date is valid if and only if:
• 10000>year> 2022
• 1 <= month <= 12
• 1 <= day <= daysInMonth(month, year)
• daysInMonth = 30 if the month is April, June, September, or November

• daysInMonth = 31 if the month is January, March, May, July, August, October, or December
• daysInMonth = 28 if the month is February and is not a leapYear(year)
• daysInMonth = 29 if the month is February and is a leap Year(year) A year is a leap year if
• The year is divisible by 400
• The year is divisible by 4 and if the year is not divisible by 100
So, the year 2000 was a leap year, 2004 was a leap year but 2100 will not be a leap year

Time
The time (Start time and End time) of an appointment is valid if and only if:
• 7 <= Start/End Time <= 22
• Start<End;
• ignore minutes and seconds, only integral point input
Taking both date and time into account, an appointment needs to start later than the time when the appointment is being added to the Schedule.

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.rar

Reference no: EM133137597

Questions Cloud

Recruitment-selection and performance appraisal of personnel : With reference to the sample graphic rating scale for a professor [PDF, 131 KB, new window], evaluate its effectiveness with respect to the criteria outlined on
Describe the key ideas of hospice care : Explain the role of advanced directives in promoting a continued sense of human agency in making choices.
Why do you think so many people not saving for retirement : Why do you think so many people are not saving for retirement? What are the benefits of doing so
What the equity in income of Harley : Assume Archer has the ability to significantly influence the operations of Harley. What the equity in income of Harley
CSC5020 Foundations of Programming Assignment : CSC5020 Foundations of Programming Assignment Help and Solution, University of Southern Queensland - Assessment Writing Service
Competitive and defensive actions : First, you must describe the offensive and defensive competitive tactics that a company can use as location strategies.Then, choose the tactic that you consider
Interpretation of the charles osgood quote : 1. How can the concept (yeah-but) become unproductive when trying to understand and resolve conflict?
What is the after tax cost of debt : The coupon rate on a debt issue is 12%. If the yield to maturity on the debt is 9.33%, what is the after tax cost of debt (for a cost of capital calculation)
Interpretation of the charles osgood quote : 1. How can the concept (yeah-but) become unproductive when trying to understand and resolve conflict?

Reviews

Write a Review

Programming Languages Questions & Answers

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd