A car hire company is an organisation that generally rents vehicles to clients over a time frame of a couple of days to a couple of weeks. Hiring a car is a common practice for those who have taken a...

1 answer below »
A car hire company is an organisation that generally rents vehicles to clients over a time frame of a couple of days to a couple of weeks. Hiring a car is a common practice for those who have taken a plane to a destination and wish to be able to manage their own transport needs on the ground. It is also becoming increasingly common for residents of a town to avoid the ongoing expenses of owning their own car, and to simply hire a car locally whenever they need one. In this assessment task you will create your own Java based (command line) program that will allow a customer to make a partial booking of a vehicle through a car hire company. It is strongly recommended that you read through the entire assessment before commencing any of the tasks.there a ton of tasks in this assessment


© Didasko 2019. All rights reserved. 1 CSE1OFX Object Oriented Programming Fundamentals Assessment 3 – Car Rental Assessment Objectives ▪ Discuss the concepts of classes, objects, encapsulation and inheritance relating to object-oriented programming paradigm and apply them to solve a real-world problem. ▪ Analyse mathematical, scientific and other types of problems and design logical solutions for each suitable for implementing as a computer program. ▪ Use an object-oriented programming language, and associated class libraries, to develop object-oriented programs. ▪ Use a development environment to develop, test, and debug programs that solve a given problem. ▪ Design and develop a test plans to ensure that a given programming solution works the way as anticipated in both expected and unexpected scenarios. ▪ Construct appropriate diagrams and textual descriptions to communicate the static structure and the dynamic behaviour of any object-oriented programming solution. This is an INDIVIDUAL assignment. Students are not permitted to work in a group when writing this assignment. Copying, Plagiarism This is an individual assignment. Students are not permitted to work in a group when writing this assignment. Plagiarism is the submission of another person’s work in a manner that gives the impression that the work is their own. La Trobe University treats plagiarism seriously. When detected, penalties are strictly imposed. Further information can be found on http://www.latrobe.edu.au/students/academic- integrity/explanation/plagiarism Submission Guidelines • Your assignment submission should be typed, not written/drawn by hand. • Submit the electronic copy of your assignment through the subject Learning Portal. • Submission after the deadline will incur a penalty of 5% of the available marks for that task per day capped at 5 days. No assignment will be accepted after 5 days. If you have encountered difficulties that lead to late submission or no submission, you should apply for special consideration. http://www.latrobe.edu.au/students/academic-integrity/explanation/plagiarism http://www.latrobe.edu.au/students/academic-integrity/explanation/plagiarism 2 © Didasko 2019. All rights reserved. Contents CSE1OFX Object Oriented Programming Fundamentals.................................. 1 Assessment 3 – Car Rental ........................................................................... 1 Assessment Objectives ................................................................................................. 1 Copying, Plagiarism ....................................................................................................... 1 Summary ........................................................................................................ 3 Scenario ......................................................................................................... 3 Implementation in Java .................................................................................. 3 Solution design............................................................................................... 6 Car Class ....................................................................................................... 7 PremiumCar Class ......................................................................................... 8 Car Booking ................................................................................................... 8 Customer ....................................................................................................... 9 CarAndBookingDates class ......................................................................... 10 MenuDisplay ................................................................................................ 11 PrintBookingDetails ...................................................................................... 11 CarRentalTester ........................................................................................... 11 Assessment Tasks ....................................................................................... 12 Task overview ....
Answered Same DayMar 06, 2021CSE1OFXLa Trobe University

Answer To: A car hire company is an organisation that generally rents vehicles to clients over a time frame of...

Abhishek answered on Mar 08 2021
159 Votes
51649 - Car Hire/Screenshots/9_1.png
51649 - Car Hire/Screenshots/8_2.png
51649 - Car Hire/Screenshots/8_1.png
51649 - Car Hire/Screenshots/9_2.png
51649 - Car Hire/Screenshots/7_2.png
51649 - Car Hire/Screenshots/6_2.png
51649 - Car Hire/Screenshots/6_1.png
51649 - Car Hire/Screenshots/Test1.png
51649 - Car Hire/Screenshots/Test2.png
51649 - Car Hire/Screenshots/Task5.png
51649 - Car Hire/Screenshots/Task4.png
51649 - Car Hire/Screenshots/7_1.png
51649 - Car Hire/Solution/UML Class Dia.png
51649 - Car Hire/Solution/xxx_cse1ofx_assessment3_uml.vsdx
51649 - Car Hire/Solution/xxx_cse1ofx_assessment3_code.docx
Task 4:
Run the code with the inputs to test for exception handling:
File name: car.csv
Screenshot:
Task 5:
Run the code with the following inputs to validate the car number selection:
Car number: 6
Screenshot:
Task 6:
Run the code with the following inputs to validate the start date values:
Car number: 1
Start Date:
Year – 202
Month – 13
Day – 32
After every input add a valid input to proceed.
Screenshot:
Task 7:
Run the code with the following inputs to verify end date is not before start date:
Car number: 2
Start Date: Year – 2020, Month – 5, Day – 1
End Date: Year – 2020, Month – 4, Day – 13
Customer details: Use your name, email and address.
Screenshot:
Task 8:
Run the code to with the following inputs to make a booking for premium car:
Car number: 1
Start Date: Year – 2020, Month – 10, Day – 5
End Date: Year – 2020, Month – 10, Day – 15
Customer details: For customer details use your name, email and address.
Screenshot:
Task 9:
Run the code with the following inputs to make a booking for standard car:
Car number: 5
Start Date: Year – 2020, Month – 9, Day – 1
End Date: Year – 2020, Month – 9, Day – 18
Customer details: Use your name, email and address.
Screenshot:
51649 - Car Hire/Solution/xxx_cse1ofx_assessment3_ts1.docx
Software Testing and Quality Assurance Administration Guide
Software Testing and Quality Assurance Administration Guide
Test Case Template
        Project name:
        
        Module:
        
        Requirement num:
        
        Requirement name:
        
        Test scenario num:
        1
        Test scenario name:
        
        Description:
        Testing all scenarios for validateDayString
        Level of testing:
        Regression
        Developer:
        
        Tester:
        
        Date:
        7-March-2020
        Test case num
        Test case name
        Test steps
        Test data
        Expected result
        Pass / fail
        1
        Day for hire greater than
0
        1. Select 1 to make a booking
2. Select Car Number as 3
3. Enter the year greater than or equal to current year
4. Enter a valid month
5. Enter the day as 2
        Car Number: 3
Year: 2020
Month: 2
Day:2
        The day must be accepted and prompt for Enter End Date must appear
        Pass
        2
        Day for hire 30 or less than 30 for November
        1. Select 1 to make a booking
2. Select Car Number as 3
3. Enter the year greater than or equal to current year
4. Enter month as 11
5. Enter the day as 30
        Car Number: 3
Year: 2020
Month: 11
Day:30
        The day must be accepted and prompt for Enter End Date must appear
        Pass
        3
        The day for hire is less than zero
        1. Select 1 to make a booking
2. Select Car Number as 3
3. Enter the year greater than or equal to current year
4. Enter month as 11
5. Enter the day as -1
        Car Number: 3
Year: 2020
Month: 11
Day:30
        The day must not be accepted and prompt for getting the day must be displayed again
        Pass
        4
        The day for hire is 32 or more for the month of January
        1. Select 1 to make a booking
2. Select Car Number as 3
3. Enter the year greater than or equal to current year
4. Enter month as 1
5. Enter the day as 32
        Car Number: 3
Year: 2020
Month: 1
Day:32
        The day must not be accepted and prompt for getting the day must be displayed again
        Pass
        5
        The day for hire is 31 or more for the month of November.
        1. Select 1 to make a booking
2. Select Car Number as 3
3. Enter the year greater than or equal to current year
4. Enter month as 11
5. Enter the day as 31
        Car Number: 3
Year: 2020
Month: 11
Day:31
        The day must not be accepted and prompt for getting the day must be displayed again
        Pass
Computer Power Institute     (
2
)
51649 - Car Hire/Problem/testcasetemplate-ca2ex54q.docx
Software Testing and Quality Assurance Administration Guide
Software Testing and Quality Assurance Administration Guide
Test Case Template
        Project name:
        
        Module:
        
        Requirement num:
        
        Requirement name:
        
        Test scenario num:
        
        Test scenario name:
        
        Description:
        
        Level of testing:
        
        Developer:
        
        Tester:
        
        Date:
        
        Test case num
        Test case name
        Test steps
        Test data
        Expected result
        Pass / fail
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
14
Computer Power Institute    
51649 - Car Hire/Problem/cse1ofx-assessment-3-car-rental-v1-tjkf4pnw.pdf
© Didasko 2019. All rights reserved. 1
CSE1OFX
Object Oriented Programming Fundamentals
Assessment 3 – Car Rental
Assessment Objectives
▪ Discuss the concepts of classes, objects, encapsulation and inheritance relating to
object-oriented programming paradigm and apply them to solve a real-world
problem.
▪ Analyse mathematical, scientific and other types of problems and design logical
solutions for each suitable for implementing as a computer program.
▪ Use an object-oriented programming language, and associated class libraries, to
develop object-oriented programs.
▪ Use a development environment to develop, test, and debug programs that solve a
given problem.
▪ Design and develop a test plans to ensure that a given programming solution works
the way as anticipated in both expected and unexpected scenarios.
▪ Construct appropriate diagrams and textual descriptions to communicate the static
structure and the dynamic behaviour of any object-oriented programming solution.

This is an INDIVIDUAL assignment. Students are not permitted to work in a group
when writing this assignment.
Copying, Plagiarism
This is an individual assignment. Students are not permitted to work in a group when writing
this assignment. Plagiarism is the submission of another person’s work in a manner that
gives the impression that the work is their own. La Trobe University treats plagiarism
seriously. When detected, penalties are strictly imposed.
Further information can be found on http://www.latrobe.edu.au/students/academic-
integrity/explanation/plagiarism
Submission Guidelines
• Your assignment submission should be typed, not written/drawn by hand.
• Submit the electronic copy of your assignment through the subject Learning Portal.
• Submission after the deadline will incur a penalty of 5% of the available marks for
that task per day capped at 5 days. No assignment will be accepted after 5 days. If
you have encountered difficulties that lead to late submission or no submission, you
should apply for special consideration.
http://www.latrobe.edu.au/students/academic-integrity/explanation/plagiarism
http://www.latrobe.edu.au/students/academic-integrity/explanation/plagiarism
2 © Didasko 2019. All rights reserved.
Contents
CSE1OFX Object Oriented Programming Fundamentals.................................. 1
Assessment 3 – Car Rental ........................................................................... 1
Assessment Objectives ................................................................................................. 1
Copying, Plagiarism ....................................................................................................... 1
Summary ........................................................................................................ 3
Scenario ......................................................................................................... 3
Implementation in Java .................................................................................. 3
Solution design............................................................................................... 6
Car Class ....................................................................................................... 7
PremiumCar Class ......................................................................................... 8
Car Booking ................................................................................................... 8
Customer ....................................................................................................... 9
CarAndBookingDates class ......................................................................... 10
MenuDisplay ................................................................................................ 11
PrintBookingDetails ...................................................................................... 11
CarRentalTester ........................................................................................... 11
Assessment Tasks ....................................................................................... 12
Task overview .............................................................................................. 12
Tasks 1-2: UML ............................................................................................ 12
Task 3: Test scenario 1 ................................................................................ 12
Tasks 4 - 9: Implementation ......................................................................... 13
Instructions 13
Implementation tips for Tasks 4-9 ................................................................................ 15
Submitting your assignment ......................................................................... 15
Assessment marking criteria ........................................................................ 16
© Didasko 2019. All rights reserved. 3
Summary
A car hire company is an organisation that generally rents vehicles to clients over a time frame of a
couple of days to a couple of weeks.

Hiring a car is a common practice for those who have taken a plane to a destination and wish to be
able to manage their own transport needs on the ground. It is also becoming increasingly common
for residents of a town to avoid the ongoing expenses of owning their own car, and to simply hire a
car locally whenever they need one.


In this assessment task you will create your own Java based (command line) program that will allow
a customer to make a partial booking of a vehicle through a car hire company.

It is strongly recommended that you read through the entire assessment before commencing any of
the tasks.
Scenario
Carrington Cars has been a player in the car rental market for many years. The organisation prides
itself on customer service and has numerous rental centres in convenient locations around the city
of Melbart. The organisation has recently seen a significant increase in the number of customers
arriving at their centres without securing a booking online. In many cases the staff at centres are
overwhelmed, leading to delays in customer support. In an effort to streamline the customer service
experience Carrington wish for customers to be able to make a partial booking onsite
using an in-store console-based system. This partial booking is then finalised by Carrington staff in
person with the customer when they become available.


Implementation in Java
Your Java based implementation will be console based. As such the Car Booking system will be
implemented with text prompts, standard output, and an ASCII-art drawing where required. You will
also need to read data from a file in CSV format.

Initially when the program starts, the following should be in place:
• a welcome message
• A prompt to the customer to retrieve the file, as shown in the figure 1.
• Figure 2 shows the session trace for booking operation

4 © Didasko 2019. All rights reserved.




Figure 1: The user enters the file name (carlist.csv).
Cars available and the totals displayed.
The user gets two option to proceed ahead.
© Didasko 2019. All rights reserved. 5


Figure 2: Make a booking option selected.
Allows the user to select the car from the car list.
Enters the start, end dates and the customer details.
Generates the summary based on the details entered.
Menu option displayed for another booking or exit the program.
6 © Didasko 2019. All rights reserved.
Solution design
The solution will comprise of eight classes as outlined below
It is expected that your solution will have the following functionality:
• The user should be presented with an initial welcome message
• The program should ask the user for the file name to retrieve the records and display in a
tabular format. An appropriate error message should be displayed if the file is unable to be
retrieved.
• Details on the cars to be hired (including daily rates) are to be retrieved the ‘CarList.csv’
file.
• The program should allow the user to enter a selection to proceed or exit from the program
o Make a booking
o Exit
• The program should allow a user to select a car that they would from the list
• The program should prompt the user for the start and end dates of a hire.
• The program should capture the following details from a user
o Name
o Email
o Address
• There are two types of Cars:
o Standard Cars (as represented in the Car class). Standard cars have a base daily
rate of hire.
o Premium Cars (as represented in the PremiumCar class, an extension of the Car
class). On top of the daily rate, premium cars have extra costs as outlined below
The program should be able to manage the fact that there are extra costs associated with
the hire of Premium cars, those being:
o The need to pay insurance on the hire of a premium car. Insurance is calculated as
being 5% of the value of the daily rate.
• The program should calculate the cost of the hire dependent upon
o Daily rate of hire
o Number of days of hire
o Extra costs for Premium cars (as outlined above)
© Didasko 2019. All rights reserved. 7
• The following information should be displayed to the user as a summary
o Customer details
o Booking confirmation
o Car Hired
o Start and End dates of hire
o Number of days of hire
o Rate per day
o Total Cost of Hire


The following sections describe the classes that make up the program
Car Class
This class holds information related to individual cars that are available for hire
Instance variables:
Name Data Type Description
carRate double The base cost of hiring a car
carName String The name of the type of car

Constructors and methods:
Name Return value Input parameters Description
Car n/a String carName
double carRate
Constructor to initialise instance
variables.
getCarRate double None Accessor method for ‘carRate’
setCarRate void None Mutator method for ‘carRate’
getCarName String None Accessor method for ‘carName’
setCarName void None Mutator method for ‘carName’
8 © Didasko 2019. All rights reserved.
PremiumCar Class
This class is an extension of the Car class. As such, all existing functionality is automatically
inherited. This documentation lists additions and differences only.
Instance variables:
Name Data Type Description
INSURANCERATE double Constant representing the percentage rate of
insurance

Constructors and methods:
Name Return
value
Input
parameters
Description
PremiumCar n/a None Constructor to initialise instance variables.
getCarRate double None Override method of Car Class
Car Booking
This class does all the work of calculating duration and cost of the hire of a car
Instance variables:
Name Data Type Description
startDate LocalDate Start Date of Booking
endDate LocalDate End date of Booking
carNumber int ID number of car
totalDays long Duration of booking in days
newRate double Calculated rate of booking
cost double Total cost of booking
car Car Car that is associated with booking


Constructors and methods:
Name Return
value
Input parameters Description
CarBooking n/a startDate LocalDate,
endDate LocalDate,
carNumber int
Constructor to initialise instance
variables.
makeBooking void None The method reads the CSV file:
implement them with the try/catch
mechanism, and print an error message
and exit when caught.
© Didasko 2019. All rights reserved. 9
Car number selected would be required
to retrieve the details and store them in
an array.
Based on the car type determine if a
new rate is required or the existing rate
to total calculate cost.
Calls the calculateCost method.
calculateTotalDays void None Calculates the difference
ChronoUnit.between method returns
the value in total days.
calculateCost void double newRate
long totalDays
Sets the cost of a booking based on the
rate by the number of days
getCost double None Accessor method for ‘cost’
getStartDate Date None Accessor method for ‘startDate’
getEndDate Date None Accessor method for ‘endDate’
getTotalDays long None Accessor method for ‘totalDays’
getCarNumber Int None Accessor method for ‘carNumber’
getNewRate double None Accessor method for ‘newRate’
getCarName String None Accessor method for ‘carName’
Customer
This class manages the details of the customer looking to hire a car
Instance variables:
Name Data Type Description
customerName String Name of the customer
customerEmail String Email address of the customer
customerAddress String Address of the customer


Constructors and methods:
Name Return
value
Input parameters Description
Customer n/a String customerName
String customerEmail
String customerAddress
Constructor to initialise
instance variables.
getCustomerName String None Accessor method for
‘customerName’
getCustomerEmail String None Accessor method for
‘customerEmail’
getCustomerAddress String None Accessor method for
‘customerAddress’
10 © Didasko 2019. All rights reserved.
setCustomerName void None Mutator method for
‘customerName’
setCustomerEmail void None Mutator method for
‘customerEmail’
setCustomerAddress void None Mutator method for
‘customerAddress’


CarAndBookingDates class
This class manages user selections of the car they would like to hire, and the dates they would like
to hire it over.
Instance variables:
Name Data Type Description
year int Contains the year value
month int Contains the month value
day int Contains the day value

Constructors and methods:
Name Return
value
Input
parameters
Description
CarAndBookingDates n/a None Constructor to initialise instance
variables with default values
carSelection int int
carsAvailable
A count of the number of cars
available for hire
getCarBookingDateFull LocalDate None Returns Year and Month and Day
of booking date.
promptForYear int None User prompt for year of date
promptForMonth int None User prompt for month of date
promptForDay int None User prompt for day of date
validateYearString boolean String year Check if year value is valid
validateMonthString boolean String month Check if month value is valid
validateDayString boolean String day Check if day value is valid


© Didasko 2019. All rights reserved. 11
MenuDisplay
This class manages the retrieval of available cars from a CSV file and displays them to the user
Constructors and methods:
Name Return value Input parameters Description
displayCarList int None Displays list of cars to user and return the
number of records
getSelection int None Prompt to enter or exit from the system


PrintBookingDetails
This class displays details of a finalised booking to the user.
Constructors and methods:
Name Return
value
Input parameters Description
printBookingDetails void CarBooking
carBooking
Customer customer
Displays the details of booking to
customer or user

CarRentalTester
This is the overall entry point for the program, controlling access to the main menu, customer details
and car booking information.
Instance variables:
Name Data Type Description
menu MenuDisplay Instance of the MenuDisplay class
customer Customer Instance of the Customer class
carBooking CarBooking Instance of the CarBooking class
carAndBookingDates CarAndBookingDates Instance of the CarAndBookingDates class
Constructors and methods:
Name Return value Input parameters Description
main void None Entry point for program



12 © Didasko 2019. All rights reserved.
Assessment Tasks
Task overview
The assessment is sub divided into UML and Java tasks. Out of these the first tasks are UML while
the rest are of Java. Ensure that you complete the tasks in sequential order i.e. you do not start a
task until the preceding tasks are finished.
Tasks 1-2: UML
Create a complete UML class diagram in Visio 2016 for the Car Rental program. Marks will be
awarded for classes (Task 1) and relationships (Task 2). Details of the classes and relationships are
given in the solution design section. The marking rubric below gives more details about the
components we are expecting.

Task 3: Test scenario 1
Download and fill in the Test_Case_Template.docx from the learning portal. The document can be
found in Week 8 for the subject. The template will be used for testing the inputs for the
CarAndBookingDates.validateDayString() method.
The test scenario should cover the following tests that generate valid outcomes
1. The day for hire is greater than zero
2. The day for hire is 30 or less for the month of November
…and the following test cases that generate invalid outcomes
3. The day for hire is less than zero
4. The day for hire is 32 or more for the month of January
5. The day for hire is 31 or more for the month of November.
© Didasko 2019. All rights reserved. 13
Tasks 4 - 9: Implementation
Instructions

Implement the Car Hire program as a NetBeans 8.2 project using Java 8.
Your solution should abide by the following best practices:
a) Error handling for user input.
b) Consistent code indentation with one level of indentation per block.
c) Code commenting for each class, all methods, and some inline comments.
d) Good naming conventions.
e) Reasonable code line lengths.

Marks of allocated for following these best practices. Refer the rubric for further details.


Testing the code
After you have finished writing the code, test it by performing the following tasks. Your response
must include a screenshot of the output for each of the following tasks.

Task 4:

Run the code with the inputs to test for exception handling:
File name: car.csv

Task 5:

Run the code with the following inputs to validate the car number selection:
Car number: 6


Task 6:

Run the code with the following inputs to validate the start date values:
Car number: 1
Start Date:
Year – 202
Month – 13
Day – 32
After every input add a valid input to proceed.
14 © Didasko 2019. All rights reserved.
Task 7:

Run the code with the following inputs to verify end date is not before start date:
Car number: 2
Start Date: Year – 2020, Month – 5, Day – 1
End Date: Year – 2020, Month – 4, Day – 13
Customer details: Use your name, email and address.

Task 8:

Run the code to with the following inputs to make a booking for premium car:
Car number: 1
Start Date: Year – 2020, Month – 10, Day – 5
End Date: Year – 2020, Month – 10, Day – 15
Customer details: For customer details use your name, email and address.
Task 9:

Run the code with the following inputs to make a booking for standard car:
Car number: 5
Start Date: Year – 2020, Month – 9, Day – 1
End Date: Year – 2020, Month – 9, Day – 18
Customer details: Use your name, email and address.
© Didasko 2019. All rights reserved. 15
Implementation tips for Tasks 4-9
Try to break down the logic in the assessment into small sections. In general, you should focus on
implementing, testing and running small sections of the assessment at a time. This ensures that
building blocks for your assessment are sound. Also, if you make any errors in your code, they will
be more easily identified and rectified.
If you find that any of the methods are particularly long, you are welcome to introduce additional
‘helper’ methods to break up your work.
Make sure that you lodge a support request if you would like any guidance.


Submitting your assignment
When you have completed your answers, submit the assessment on the Learning Portal. You should
submit the following:

Task number File name Description
Tasks 1-2 xxx_cse1ofx_assessment3_uml.vsdx Visio UML diagram.
Task 3 xxx_cse1ofx_assessment3_ts1.docx Test scenario 1.
Tasks 4-9 xxx_cse1ofx_assessment3_code.zip
xxx_cse1ofx_assessment3_code.docx
Implementation tasks.
Task 4-9 screenshots

Notes:
• Replace the “xxx” placeholders with your Student ID.
• The Zip file mentioned above is a compressed version of your code solution folder.

16 © Didasko 2019. All rights reserved.
Assessment marking criteria
The complete...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here