MY JAVA FINAL PROJECT ASSIGNMENT....PLEASE HELP! You have to build a software fo
ID: 3682065 • Letter: M
Question
MY JAVA FINAL PROJECT ASSIGNMENT....PLEASE HELP!
You have to build a software for a bike rental shop. The shop rents bikes, kayaks and Segways and needs a software that keeps track of ongoing rentals, annotates times, calculates prices and generates receipt all from a graphical user interface. We will call a rental item to a bike, kayak or Segway that it is rented.
Each rental item can be rented. The carges to the client who rents the rental item is computed based on a base fee plus a per-hour fee, depending of how long was the rental. When
a rental item is beng rented, we say it is not available. An availabe rental item is not currently rented.
You will build this software in phases. The first phase is specified in this document and will be graded aas Assignment 5. It involves to create some core classes to implement the rental functionality and read/write information about rented items and receipts from and to text files.
The next phase will enhance these functionalities and will take care of the user interface.
1. Create a Eclipse project named [your pitt id]_finalproject
2. Create a package edu.pitt.is17.[your pitt id].finalproject
3. Build the class rentalItem as specified in the class diagram below. It represents an item that can be rented in the shop. The attribute type sets if it is a bike, a kayak or a Segway.
+RentalItem(itemId: String, type: String)
+RentalItem(itemId: String, type : String, baseFee: double, hourPrice: double)
+rent(clientName: String)
+returnItem(): Receipt
+available() : boolean
a. Create all attributes. The constant TAXES_RATE should be set to 0.07 (7%).
b. Create getters and setters for all attributes.
c. Create the constructors. Attributes not passed as parameters should be set to default values:
rentalStartDate and clientName should be set to null. Chheck that type is one of "bike", "kayak" or "segway".
If not, set as "bike" by default.
d. Implement the method rent. It receives the name of the client who is renting (should set the attribute clientName), and it should set rentalStartDate to the current system date. You have to research on how to manage Dates in Java. You can start looking at the API documentation of the class Date at https://docs.oracle.com/javase/7/docs/api/java/util/Date.html
e. The method available returns true if rentalStartDate is null (it means is not currently rented).
f. The method returnItem does the process of returning a rented item. The functionality of this method is described:
i. First, it registers the current date and computes the difference with the rentalStartDate in hours.
TIP: there is a way to subtract Date objects and to get the difference in hours.
ii. Using the amount of hours of the rental and the attributes baseFee and hourPrice, it computes the sub total charges. It also compute the taxes using the total charges and the
TAXES_RATE. Keep the computed sub total and taxes as double variables.
iii. Using the attributes of the rented item (itemId, type, clientName,baseFee,hourPrice), plus the computed data from point (i) and
ii), creates a Receipt object (see class Receipt in point 4 below).
iv. After creating the receipt object, it sets rentalStartDate and clientName to null (which is setting the rental item to available state).
v. Finally, it returns the receipt object.
4. Create the class Receipt as shown in the diagram below
-ItemId : String
-type : String
-baseFee : double
-hourPrice : double
-rentalEndDate : Date
rentalEndDate : Date
-clientName : String
-subTotal : double
-taxes : double
a. Create all attributes and create getter and setters for all of them.
b. Create the constructor. All the values for the attributes are passed in the contructor
parameters, except the rentalEndDate, which has to be set as the current date.
c. The method toString generates a String representation of the receipt. Look at the example receipt below.
Example receipt
Client Name: Harry P.
Rented item id: B0001 (bike)
Rental started: 03/12/2016 11:45:04
Rental ended: 03/12/2016 12:52:16
Rental time: 01:07:12
Base fee: 15.00
Hour price: 22.99
Subtotal: 40.75
Taxes (7%): 2.85
TOTAL CHARGES: 43.60
5. Implement the class RentalManager. This class manages an array (ArrayList) of rental items providing functionalities to read the data from a text file and generate text files for the receipts.
(a). Create getters and setters for both attributes.
(b)Constructor RentaManager initializes the ArrayLists rentalItems and receiptHistory (which at the beginning are empty).
(c)The method loadItems read a file (indicated by filename parameter) and creates RentalItems object out of each of the lines of the file, adding them to the ArrayList rentalItems. Each
line of the file contains the data of a rental item with all necessary attribtes separates by comma:
itemId,type, baseFee, hourPrice.
An example file is given at the end of this document.
(d)Method getAvailableItems returns an ArrayList containing all the RentalItem objects which are available, not being currently rented (check method available() in class RentalItem).
(e) Method getAllItems return the complete rentalItems ArrayList.
(f) Method removeAllItems empty the rentalItems ArrayList.
(g)Method addReceipt add a receipt (parameter) to the receiptHistory ArrayList.
(h) Method computeTotalIncome sums all total charges from all the receipts in ArrayList receiptHistory.
(i)Method printReceipt is static.It receives a Receipt object and generates a file containing the output of the method toString of the receipt. It names the file using the values of the rentalStartDate and the clientName form the receipt object.
For example, 03/12/2016 11:45:04_Harry P.txt.
General aspects:
Follow the name conventions for naming your classes, variables and constants.
Make sure your indentation is correct. You can use Correct Indentation menu option in Eclipse before submitting your code. Export your project and compress it in a file named [your pittid]finalprojectPHASE1.zip. Due date is Thursday March 31st 23:59
PM. Submit using course web submission tool.
Example rental items file:
B001,bike,15.00,22.99
B002,bike,15.00,22.99
B003,bike,15.00,22.99
B004,bike,10.00,22.99
B005,bike,10.00,22.99
B006,bike,10.00,22.99
B007,bike,15.00,25.00
B008,bike,15.00,25.00
K001,kayak,5.00,12.50
K002,kayak,5.00,12.50
K003,kayak,7.50,15.50
K004,kayak,7.50,15.50
S001,segway,20.00,25.99
S002,segway,20.00,25.99
S003,segway,20.00,25.99
RentalItem -itemId : String-type : String
-baseFee: double
-hourPrice : double
-rentalStartDate : Date
-clientName : String
+TAXES_RATE : double
+RentalItem(itemId: String, type: String)
+RentalItem(itemId: String, type : String, baseFee: double, hourPrice: double)
+rent(clientName: String)
+returnItem(): Receipt
+available() : boolean
Explanation / Answer
Please find all the required files below :
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.