Rudimentary Client Database program in Python
Assignment 2 Type: Programming Task Stott's College
For this assessment, you will be required to write a rudimentary Client Database program using techniques discussed in class.
It is expected that you program all the input and output yourself, making the experience seem like that of a standard command line application. Students are required to follow methods discussed in class, other methods will not be necessarily penalised, but penalties may occur if they clearly are against the spirit of the assessment.
Purpose and Expectations
The goal of this assessment is to provide you a means of demonstrating your programming skills in Python, that you have developed this far. We want you to flesh out your creativity. As such, very specific instructions will not be provided, instead the desired type of program will be outlined, and additional optional resources will be provided.
This is a ‘layered’ assignment, so acquiring adequate marks should not be particularly difficult (nor is it intended to be). Put simply, the minimal requirement is straightforward and worth a substantial amount of the overall marks of this assignment, however, the more you work on improving your code the better score you will achieve.
The program will be described as a list of requirements. A video demonstration of the output of the generic implementation will be provided, along with example code that applies a different scenario.
Please NOTE: You do not need to review either the video of the potential output, or reference the example code if you understand the outline, as they are simply provided as support for those who are in anyway confused with the expectations or do not know how to get started.
Outline and Requirements
Write a Python Program that manages a Database of clients, in this scenario you are hypothetically an employee at a business that would like to organise their client information in a very tailored fashion and has requested that you develop the software.
The requirements of the Client Database Software are as follows:
Base Requirements: (very fastto implement, check the example code) [10 Marks]
- A main menu is to be displayed in which the user is given a list of tasks that they can select from.
- Main Menu Item: View the database (i.e. list) of clients.
Make them neat. If you wish to use a table for example, you may find the "\t" (tab character) helpful.
- Main Menu Item: Add a client to the database.
Information to be recorded about the client is:
- Client’s Name.
- Amount of money that your company charges them peer week.
- How many hours you spend contacting them, on a weekly basis.
- Main Menu Item: Exit the software.
Intermediate Requirements: [7 Marks]
- Loop the main menu, causing the user to always return to it after a task is complete.
- Clear the screen (the previous text) after a task is completed, there should only ever be onemenu screen at a time.
- Main Menu Item: Delete a client from the Database.
a_list.remove(x) #remove based on the value of item x in a_list a_list.pop(i) #remove based on the index (e.g. i) in a_list
- Error Checking – Ensure the Software never crashes (i.e. does not get an error and stops working) and will explain to the user what issue has occurred and return to the main menu and continuing functioning as expected; this can be achieved with both IF Statements and Try-Except exception handling techniques. If you can make red text appear by using unexpected input, please do your best in making sure the user cannot.
- Smooth responses to extreme cases. For example, if the user selects to delete a client from the database that does not exist the program simply tells them that they are not found and returns to the menu, or if the user selects to show all clients without any first being added the program simply reminds the user.
- Use only one list variable to store the client data.
Instead of having for example client_names = [ ], client_charges = [ ] and client_hours = [ ], just have clients = [ ] instead.
- You could store the client data in the clients list as a large string, then when you need to retrieve data from it you could use the split( ) function. Thus, clients would be a list that would look something like this:
clients >> ["Justin 500 3", "Jayson 1200 1 "] clients.split(" ") >> 500 clients.split(" ") >> 3 clients.split(" ") >> Jayson
- OR, you could use ‘2d lists’ to store the client data, that is to say clients is a list of lists, in which each list item / element is [name, charge, hours]. Thus, clients would be a list that would look something like this:
clients >> [["Justin", 500, 3], ["Jayson", 1200, 1]] clients >> 500 clients >> 3 clients >> Jayson
Advanced Requirements: [3 Marks]
- Main Menu Item: Show a single random client’s information.
- Display at least two interesting statistics during the ‘2. View the database of clients’ task, this may be anything potentially relevant, such as:
- The total amount of money charged to clients.
- The total amount of hours spent in contact with clients.
- The average money charged to clients.
- The average hours spent in contact clients.
- The maximum amount of money charged to a single client.
- The minimum hours spent in contact with a single client.
You are free to decide what statistics you believe are relevant and insightful, including those of Assignment not listed here.
- Use functions to ‘tidy-up’ the loop code (refer to the example code).
A video demonstrating what the general output of your program should appear like having fulfilled all the requirements listed above.
Remember, your program does NOT have to look exactly like this. If your code does output exactly as in the video that is fine, but please do keep in mind it is only a generic guideline.
A very similar program. This program is simpler and has a different context involving cars.
You are free to use this code.
However, you will need to update the context to the Client Database System as mentioned in the outline and continue building upon it.
Check the LMS (Moodle) for this same code with extra comments that you can copy and paste, if you so desire.
Assignment files must run without error through the Python interpreter.
Make sure the code is readable. This includes utilizing meaningful variable names and comments, making sure it is spaced out and that lines are not too long (if they start to become too long, break them up. A general rule is each line should not be more than around 80 characters long).
At the beginning / top of the python code,
please make sure there is a comment stating your name and student number
Failure to provide your name and student number as a comment will result in a
1-mark deduction penalty (i.e. you will lose 1 mark :^( ) so PLEASE include the comment…
Remember, comments are made by using the hash (#) character in Python