CSE1OFX Object Oriented Programming Fundamentals Assessment 3 – Car Rental - Solution

Updated: Jan 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 plan to ensure that a given programming solution works 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/academicintegrity/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.


Table of Contents

CSE1OFX Object Oriented Programming Fundamentals ....................................................................................... 1

Assessment 3 – Car Rental ................................................................................................................................ 1

Assessment Objectives.................................................................................................................................. 1

Copying, Plagiarism ....................................................................................................................................... 1

Submission Guidelines .................................................................................................................................. 1

Summary ........................................................................................................................................................... 3

Scenario ............................................................................................................................................................. 3

Solution design .................................................................................................................................................. 3

Classes ........................................................................................................................................................... 3

Functionality.................................................................................................................................................. 4

Example of Expected Implementation ........................................................................................................... 5

Assessment Tasks .............................................................................................................................................. 7

Task overview ................................................................................................................................................ 7

Tasks 1-2: UML Diagram ............................................................................................................................... 7

Task 1: UML Classes ...................................................................................................................................... 7

Task 2: UML Class Relationships .................................................................................................................... 7

Tasks 3 - 10: Implementation ......................................................................................................................... 7

Task 11: Test scenario ................................................................................................................................. 12

Task 12: Testing the code............................................................................................................................ 12

Task 13: Coding Conventions ....................................................................................................................... 13

Submitting your assignment ............................................................................................................................ 13

Assessment marking criteria ............................................................................................................................ 14

Summary

A car hire company is an organisation that rents out cars and other vehicles to customers over a set period, usually ranging from 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 object-oriented console based (command line) program that will allow a customer to make a partial booking of a vehicle through a car hire company. The car booking system will be implemented with text prompts, standard output, and ASCII-art drawing where required. You will also need to read data from a file in CSV format.

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. To streamline the customer service experience Carrington wish for customers to be able to make a partial booking onsite using an in-store consolebased system. This partial booking is then finalised by Carrington staff in person with the customer when they become available.

Solution design

Classes

It is expected that the solution will comprise eight classes as outlined below:

Functionality

It is expected that your solution will have the following functionality:

• The user should be presented with an initial welcome message.

• Details on the cars to be hired (including daily rates) are to be retrieved from a file named ‘carlist.csv’ (provided) and displayed in a tabular format. An appropriate error message should be displayed if the file is unable to be retrieved.

• The program should allow the user to enter a selection to proceed or exit from the program i.e. user to be given the following options:

o Make a booking

o Exit

• The program should allow a user to select a car that they would like from the list

• The program should include prompts for the user to enter start and end dates of a hire. These should be:

o A prompt for the year

o A prompt for the month

o A prompt for the day

• 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, there is an extra cost with the hire of premium cars that being:

 The need to pay insurance on the hire of a premium car