FACULTY OF ENGINEERING AND INFORMATION SCIENCES
SUBJECT’S INFORMATION:
Subject:
CSIT121 Object-Oriented Design and Programming
Session:
Autumn 2020 (February)
Programme / Section:
Computer Science and IT
Lecturer:
Ms. Siti Hawa
Coursework Type
(tick appropriate box)
✓ Individual Assignment Group Assignment Project Lab Task Seminar / Tutorial Paper Others
Coursework Title:
Assignment 2
Coursework Percentage:
10%
ASSESSMENT CRITERIA:
Correctness
The application should produce the correct result as stated in the specification.
2 marks
Class design and implementation
Design of class that follows the specification provided. Class relationship is implemented. Inheritance and polymorphism correctly implemented.
3 marks
Interface design and implementation
Correctly declare interface and implemented by suitable classes.
1 mark
Exceptions Handling
Suitable exceptions handling done for at least 3 exceptional situations.
1 mark
Main Application
Correct implementation of the main method with appropriate control flow and data structures used.
2 marks
Readability and Output
Appropriate comments are included. Meaningful identifiers used. Proper indentation and line spacing used. Well formatted output and creativity shown.
1 mark
SUBMI SSION:
All completed work should be submitted online through Moodle before or on the due date provided.
SUBMIT AS EARLY AS POSSIBLE. ONLY ONE SUBMISSION IS ALLOWED. IF RE-SUBMISSION IS NECESSARY, YOU ARE REQUIRED TO REMOVE THE EARLIER SUBMISSION AND THIS MUST BE DONE BEFORE THE DUE DATE. OTHERWISE YOU WILL BE PENALIZED FOR LATE SUBMISSON.
DUE DATE:
Friday, 22nd May 2020 (11:55 pm)
PENALTIES FOR LATE SUBMISSION:
Penalties apply to all late work, except if student academic consideration has been granted. Late submissions will attract a penalty of 25% of the assessment mark per day including the weekend. Work more than (3) days late will be awarded a mark of zero.
PLAGIARISM:
When you submit an assessment task, you are declaring the following
1. It is your own work and you did not collaborate with or copy from others.
2. You have read and understand your responsibilities under the University of Wollongong’s policy on plagiarism.
3. You have not plagiarised from published work (including the internet). Where you have used the work from others,
you have referenced it in the text and provided a reference list at the end ot the assignment.
Plagiarism will not be tolerated. Students are responsible for submitting original work for assessment, without plagiarising or cheating, abiding by the University’s policies on Plagiarism as set out in the University Handbook under University Policy Directory and in Faculty handbooks and subject guides. under University Policy Directory and in Faculty handbooks and subject guides.
COURSEWORK SPECIFICATION
OBJECTIVES
This assignment aims to provide you with some experience in writing codes using Java programming language that covers the following topics:
Inheritance and Polymorphism Interface
Object Interactions
Remember that:
1. 2.
3. 4.
All programs should be able to run on the lab’s computers.
You must put the following information on the header of each text and source file you will be submitting in this assignment:
Student’s full name:
Student’s ID:
Modification Date:
Purpose of this file (or program):
Assignments that are not able to be compiled will result in zero mark given to the assignment. You must only use the Java features that have already been covered in the lectures
For this assignment, you are required to write a Java application that handles the processing of admission of customers to a typical theme park in Malaysia. The theme park keeps record of the total payment details done by each customer who entered the park. To enter the park, a customer is required to pay for the admission tickets depending on how many people the customer is bringing. The customer also may opt to rent items from the theme park. The rental items available includes rides, equipment, and locker.
There are three types of admission tickets. There are adult tickets (RM202.00 per ticket), child tickets (RM170 per ticket), and senior citizen tickets (RM150.00 per ticket). A customer may purchase any number of each of these types of tickets.
The rides provided by the theme park are bungy jump ride and go kart ride. The price for each bungy jump ride depends on whether the customer has a MyKad or not. A MyKad holder customer has to pay RM85.00 for a single bungy jump ride while the non-MyKad holder has to pay RM147.00 for the same ride. The go kart ride gives a customer a choice of whether to rent a single go kart or a double go kart. The rental price for a single go kart is RM35.00 and for a double go kart is RM40.00.
The theme park also provides equipment to be rented that includes tubes (either single tube or double tube) and surf board. To rent equipment, a customer has to pay a deposit (which is returnable) and the rental amount. The summary of the rental for equipment is shown in the table below:
Equipment
Deposit
Rental
Single Tube
RM10.00
RM16.00
Double Tube
RM20.00
RM25.00
Surf board
RM20.00
RM32.00
There are two types of locker provided by the theme park – small locker and large locker. The rental amount for a
small locker is RM20.00 and the rental for the large locker is RM50.00.
To implement this application, you are required to design and develop the following classes, interface, and relationships.
The Customer Class
Each customer will provide the following details:
The customer name
The contact number
The payment method
Payment method can either be cash, visa, master, or online payment.
Admission tickets
This should be declared as an object of class Ticket that is described below.
Rental items details
This should be declared as an ArrayList
A suitable constructor
Suitable accessor and mutator methods
The Ticket Class
The Ticket class is used to keep track of the number of adult tickets, child tickets, or senior citizen tickets purchased by a customer. The class should also be able to calculate the total price of the tickets purchased. The class should have the following details:
The number of adult ticket
The number of child ticket
The number of senior citizen ticket
A suitable constructor
Suitable accessor and mutator methods
A method to calculate and return the total price of the tickets purchased
The RentalItem Class and its subclasses
The RentalItem class is a superclass that should be declared as abstract. The RentalItem class and its subclasses are partially described in the following diagram.
RentalItem
– description : String
//store either rides or equipment //or locker
//accessor and mutator methods
+ calcTotalRentals() : double
Locker
Equipment
– type : String
//either standard or
//luggage type
//suitable constructor
//accessors and mutators
– name : String //either tube or surf //board
– discRate : int //during promotions only
//suitable constructor //accessors and mutators
Rides
– name : String
//either bungy jump or
//go kart
//suitable constructor
//accessors and mutators
BungyJump
– myKad : boolean
//suitable constructor
//accessors and mutators
GoKart
– type : String
//either single or double
//suitable constructor
//accessors and mutators
Tube
– size : String
//either single or double
//suitable constructor //accessors and mutators
SurfBoard
– designBoard : boolean
//suitable constructor
//accessors and mutators
The Payable interface
Declare an interface called Payable that contains the following abstract methods:
getPaymentDetails() that process the payment details by displaying the payment due, receiving payment, and calculating balance.
printReceipt() that will display a receipt based on the payment done. This interface must be implemented by the Customer class.
The MainApp Class
Lastly, write a main() method in a class named MainApp that keeps track of several Customer objects in an ArrayList
Your application must include the following:
Ensure that all errors are handled properly. Use exception handling technique and/or condition validation as necessary.
Implement correct inheritance and class relationships.
Implement an interface.
Demonstrate the implementation of polymorphism and use instanceof and type casting at suitable
places in your codes.
Include meaningful comments in your programs and use meaningful variable and methods names.