Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 9

Car Nurk Hire Plan

Introduction:

The application is designed to help Nurk with his Car Hiring business online. In this application,
they can input their name, choose a type of car, choose their duration period, whether they
would prefer an insurance waiver or not. It then calculates the total price and final date for the
insurance period and displays it back to the user as well as saving the information in an external
document.

The Solution Requirements:

● There’s a user interface for inputting a customer's first name.


● Dropdown for choosing vehicle type (Small Sedan, Large Sedan, Wagon, SUV, Ute,
Sports Coupe, or Limousine).
● Spinbox for choosing number of days (1 to 8)
● Can save the details for display and external files.
● Calculation of total cost and final date
● Output the visual summary on-screen after button is pressed.

The User Requirements:

Easy to navigate display

Needed Inputs:
● Name of customer
● Vehicle choice (Small Sedan, Large Sedan, Wagon, SUV, Ute, Sports Coupe, or
Limousine).
● Days (1 to 8).
● Current date and return date

Shown Outputs:
● Displayed summary of the order.
● Total cost of the order.
● Total days
Design

Size and Header

The window has a specific size of 400 x 400 for an overall better layout for the program. THis
size ensures that the application window isn’t too large or small or wide which makes it easy to
navigate around the program.

The header label is large to advertise and remind the user of the company (Arial, 20) and below
it the date that shows today’s date for readability and assistance for the user.

Inputs

The next part of the code are the options and inputs that the user is required to give. This
includes name, the vehicle type they would refer, the days and whether they prefer insurance
waiver. Each option being displayed under a label is in the various forms of inputs. A spinbox for
days up to 8 days, insurance waiver as two radio buttons, the car type as a dropdown and the
customer name beeing a text field.

Return and Error

The confirm button processes the inputs to give a final cost and the return date of the vehicle..
The button calls the calculate() function and also saves changes to an external file while also
displaying the final cost under a ‘total cost’ label and return date similarly. .

A constant error label is set underneath in the bottom of the app to display any of the relevant
errors. This includes the name and failure to input any of the other inputs.

Benefits

Clarity and Simplicity: The layout is simple, avoiding complex navigation structures which is
good for the reputation of the business.

Logical Flow: All elements are laced in a logical flow, starting with the title and today's date,
moving onto inputs, then the confirm button and result labels and finally error labels.

Error Visibility: The error label at the bottom ensures that it is visible and separated from the
main elements, reducing confusion and increasing readability.

Justification:
pseudocode:

1. Start
2. Get car types and costs from
external files into dictionaries
3. Display title and today's date
4. Create input fields for Customer
Name, Car Type, Rental Duration, and
Insurance Option
5. Populate Car Type dropdown from car
types dictionary
6. Set up Radio Buttons for Insurance
Yes/No options
7. Create a Confirm button that
triggers the calculation process
8. Define labels to display total cost
and return date
9. Define a label for displaying error
messages
10. Define a function to calculate the
cost and return date while saving all
information to external files
11. Update the total cost and return
date labels with calculated values
12. End

Firstly, all input fields and output labels are inserted for user interaction. These consist of entry
fields for the customer's name, a combobox for selecting the car type, spinbox for the number of
rental days, and radio buttons for the insurance option. Labels beside labels are used to provide
the necessary output details.

Objects and relevant information aren’t necessarily stored in something, but the inputs are
rather extracted from the input form field and saved to a separate file. The only things saved are
the dictionaries in the external files.
A result label is used to display the calculated total cost and the expected return date. These
fields are updated when the 'Confirm' button is pressed, which is located above the result labels,
and is linked to the calculation function.

A function is defined that retrieves the user's inputs, including the name from the entry field and
selected options from the combobox and radio buttons. The entry field allows the user to type
their name, which the .get() function later extracts. The selected car type and insurance options
are retrieved from their respective UI components.

The total cost is calculated by matching the selected car type with its corresponding multiplier
from a dictionary, adding base costs from another dictionary based on the rental time, and
including additional costs for insurance if selected.

Before displaying the results in the output labels, the function checks whether the customer
name entry field contains a value. If it does, it proceeds with the calculations; if it doesn’t, it
displays an error message in the error label. The code also checks to see if all inputs are filled
and then continues, else displays an error in the same area.

When all inputs are validated and calculations are complete, the order summary is displayed by
updating the labels with the customer's name, selected options with their cost implications, and
the total price the customer is expected to pay.

Error handling is implemented to catch any issues during input retrieval or calculation, providing
feedback in the error label for easy debugging. This helps identify areas that may require
adjustments and ensures that any errors are communicated directly through the user interface.

Processing Features

Data Dictionary

Variable Name Data Type Description Size

root Tk object Main window of the application N/A

name_entry Entry object Text entry for customer's name N/A

car_type_combob Combobox
Dropdown to select car type 7
ox object
days_spinbox Spinbox object Spinbox to select the number of rental days 1 to 8

insurance_var Radio Buttons Variable to store selected insurance option 2

calculate_button Button object Button to trigger the calculation process N/A

total_cost_label Label object Label to display the calculated total cost N/A

return_date_label Label object Label to display the calculated return date N/A

error_label Label object Label to display error messages N/A

Dictionary storing car types and their 7


car_types dict
multipliers options

List storing base cost for the relevant


costs list 2 items
vehicles

calculate function Function to calculate cost and return date N/A

save_booking_dat
function Function to save booking data to a file N/A
a

read_car_types function Function to read car types from a file N/A

read_daily_costs function Function to read daily costs from a file N/A

today_label Label object Label displaying today’s date N/A

Radiobutton
insurance_yes Radiobutton for selecting "Yes" for insurance N/A
object

Radiobutton
insurance_no Radiobutton for selecting "No" for insurance N/A
object

header Label object Label for the application heading N/A


The code has the following input functionality for the user:
Customer's first name: Entered in the entry_name entry box.
Vehicle type: This is selected using combobox(car_typer).
Days type: This is selected using spinbox (days_spinbox).
Insurance Waiver: This is selected using radio buttons, yes or no.

Calculation of Total Cost:


The code has matching dictionaries for each car and their relevant prices, matching to
those prices that are relevant to any of the options.
The final total price is started with the car type price, then it calculates the days and adds
to the price and the insurance waiver, adding on more to the price.
The final price is later displayed with the simultaneous calculation of the final date.
If any of the selected options aren’t found in its matching dictionary, it prints an error
message in the console of python, similarly if no name is given.

External Files:

Functions read car types, read daily costs, save booking data all link to receiving and saving
data from external files. The first two get the data that are saved as dictionaries in the external
file. It extracts and processes the data using float and line.split for the relevant vehicle of the
option to get the correct data and the correct pricing. Same goes for the daily costs, which
just .strips the file and takes out the correct data.

The save booking data function saves the relevant data to an external file during the function of
calculating costs.

Displaying Order Summary:


After the total prices is calculated by the function, it will display a summary with each filter option
and its price and showing the final sum, which is the addition of all of that
The result is displayed with their relevant label swiftly after button is pressed
If no result is given, there can only be an error, displayed underneath
All results and necessary information are saved to an external file

Error Handling:
If the code does not find the selected option in its own dictionary, an error message is printed in
the console.
If the code does not find a name, it prints an error message in the same area.
If no single or more inputs are given, it prints an error message in the same area.

Event Handling:
The "Confirm" button calls the calculation of the total cost and the update of the result label with
as well as the data being saved to an external file, located in the same directory.
Testing Table

Item Tested Test Data Expected Result Actual Result

The system accepts the


Customer
Input: "Abbijeeeettt" name and proceeds As expected
Name Entry
with booking.

Car Type Selection: "Sedan" The system recognizes


As expected
Selection from dropdown the selected car type.

The system calculates


Rental
Input: 5 days costs based on a 5-day As expected
Duration
rental.

Additional insurance
Insurance
Selection: "Yes" cost is added to the As expected
Option
total cost.

System calculates the


Total Cost Based on: "Sedan", 5
total cost including all As expected
Calculation days, Insurance "Yes"
factors.

System calculates the


Return Date Start Date: Today,
correct return date 5 As expected
Calculation Duration: 5 days
days later.

Booking details are


saved to
Data Saving All input fields set As expected
"hiring_events.txt"
(external file)

Error Handling Input: Empty System displays an As expected


customer name error message
requiring a customer
name.

Debugging:

Print statements:

console:

Evaluation:

User Interface and Input Collection:


Efficiency: The user can efficiently select their filtering options from the available radio buttons,
spinbox options and combobox, as a dropdown, options to produce their final rental vehicle
order. All Inputs are accurately collected and stored.
Effectiveness: The design is effective because it avoids confusion and misunderstanding. The
users can quickly go through the options and be assured everything is stored

Order Processing and Calculation:


Efficiency: The code efficiently is able to process the users order based on the selected options
by matching it to the available dictionaries and ensure they map to the correct prices. After
retrieving the prices from the dictionary, it performs an efficient calculation without flaws to give
an exact bill to the user.
Effectiveness: The code accurately retrieves and calculates the final bill based on matching
dictionaries making it easier for the user and reducing any worry about pricing
Order Summary Display:
Efficiency: The coding efficiently displays a summary of the order, which has the return date
and the total cost. It changes the result label with the order summary in real-time after clicking
the "Confirm" button. The function is called after the Confirm is pressed and efficiently runs
through the code smoothly to give a quick final answer.
Effectiveness: The summary that is displayed is clear and gives a precise overview of the
various details of the order making it easier for the user to re-evaluate.

Error Handling:
Efficiency: The code has efficient error handling to ensure that all aspects of the order are
fulfilled and any missed information is re-considered. This avoids flaws in the final calculator and
helps the viewer with his order.
Effectiveness: All possible errors are defined in the code in order for it to be displayed to the
user as well as the console to make sure no problems continuously arise after the fixing.

Non-Functional Requirements:
Efficiency: The software isn’t too complex making it a good option for any device version etc;.
Errors coming due to devices won’t occur as the code is basic without excess cloud-based
material and back-end.
Effectiveness: The GUI layout and design are visually attractive and easy to navigate,
enhancing user satisfaction. The software fulfils non-functional requirements related to usage,
aesthetics, and performance effectively.

You might also like