Do My Homework
/
Homework Help Answers
/
Programming Homework Help
/ Java assgiment help and tutoring
Java assgiment help and tutoring
Need help with this question or any other Programming assignment help task?
I need this attached assignment to be completed asap before the due date (5/08/2022). I would like to organise some tutoring to help me understand this subject.
Additional Instructions:
COSC2135 Programming 1 SP2 2022
Assignment 2
Assignment Type
Individual assignment (no group work) worth 40% of your final grade. Please do not show or share your code
to anyone else as both parties could be found breaching RMIT Academic Integrity rules.
Note: The submitted assignment must be your own work. No marks will be awarded for any part which
is not created by you. Plagiarism is treated very seriously at RMIT. Plagiarism includes copying code
directly from other students, or from the Internet or other resources without proper reference.
Sometimes, students study and work on assignments together and submit similar files which may be
regarded as plagiarism. Please note that you should always create your own code even when you have
very similar ideas. Plagiarism-detection software will be used to check all submissions. From the
outputs of the plagiarism-detection system, we will consider any potential plagiarism case and report to
the school. Penalties will be applied in cases of plagiarism.
Deadline
23:59pm Sunday 7th August, 2022 (Melbourne time). You can submit any number of times from now until
the final deadline. It is your responsibility to gradually submit your progress without waiting until the last
moment.
Submission Instructions
You must submit a single zip file containing all model, view, controller packages and the .java files in those
packages. Submission must be done in the Assignment 2 page on Canvas.
Note:
● the zip file must be named yourStudentNumber_firstname_lastname_A2.zip
Example: s123456_John_Doe_A2.zip
● In the zip file, you must include a readme.txt file containing the following:
○ instructions about how to start the application (during the marking time, we will download
your submission and run your code on our computers according to your instructions)
○ any assumptions you made when implementing the program
○ any other comments which you want the marker to know before marking your
submission
You can submit your assignment as many times as you would like prior to the due date. The latest submission
will be graded.
Learning Outcomes
This assessment is relevant to the following Learning Outcomes:
1. Solve algorithmic computing problems using basic control structures and object-oriented techniques.
2. Design and implement computer programs based on analysing and modelling requirements.
https://www.rmit.edu.au/students/my-course/assessment-results/academic-integrity
3. Identify and apply features of an Object-Oriented programming language through the use of standard
Java (Java SE) language constructs and APIs.
4. Applying a design pattern, specifically, the model-view-controller pattern to help to enhance software
reusability and development.
5. Identify and apply a good programming style based on established standards, practices, coding
guidelines and conventions. Please refer to the Code Conventions for the Java Programming
Language from Oracle.
Overview Of Assessment
This assignment has a total mark of 100. The rubric is in the Assignment 2 page on Canvas. You are
required to complete a single application, i.e. a menu-driven, console-based application.
To complete this assignment, you will need to apply the concepts we have learnt so far and about to learn
soon, specifically the following:
● Data types, Decisions, Loops
● Console input/output
● Methods, classes and objects
● Array of objects
● Creation of exception objects and catching exceptions
● File reading and writing
● Design pattern, i.e. Model View Controller pattern
● Encapsulation, Composition, Inheritance, Polymorphism, Method Overriding
After reading through the assignment specification, you can begin by having a simple design of the application
with the basic components such as model, view and controller and the corresponding classes. You should
work on a simple implementation first, and then continue to build up and refactor your code gradually as you
progress. You should work on this assignment every week, making steady progress every week.
In addition, make sure you regularly follow the Assignment 2 discussion page on Canvas for assignment
related clarifications and discussions.
Coding Requirements
The following requirements are applied to this assignment:
● Your implementation needs to follow the Model-View-Controller pattern discussed in Week 7.
● All user inputs in the Console must be validated.
● You should aim to provide high cohesion and low coupling in the design and implementation of your
application.
● All class members are given appropriate access modifiers to maximise encapsulation and information
hiding. More details in: https://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html
● Your design & implementation must apply the use of methods, inheritance, polymorphism and method
overriding appropriately to avoid code duplication and improve the modularisation and cohesiveness of
your implementation.
● Your final code submission must be clean, neat, and well-formatted (e.g., consistent indentations) and
abide by the formatting guidelines. Please refer to the Code Conventions for the Java Programming
Language from Oracle.
● You must include adequate and meaningful comments in all the code files to make it easier for other
readers to understand your code.
● You are allowed to use any Java version from Java Development Kit (JDK) 8.0 and later.
https://www.oracle.com/java/technologies/javase/codeconventions-contents.html
https://www.oracle.com/java/technologies/javase/codeconventions-contents.html
https://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html
https://www.oracle.com/java/technologies/javase/codeconventions-contents.html
https://www.oracle.com/java/technologies/javase/codeconventions-contents.html
The following coding requirements, which are similar to those in Assignment 1, are also applied to this
assignment. They are shown below:
You must follow the naming conventions here (Note: the use of interfaces are not required in this
assignment)
You need to add implementation comments to explain your code. Your comments will make it easier for
us as a reader/assessor of your code to understand more details about your implementation.
Note:
● Documentation comments (known as "doc comments") are not required. Click here for
more details about the differences between implementation comments and doc
comments.
● Before the final submission, you need to delete any code that is no longer used in your
program, do not comment out such code.
You need to check your code carefully to make sure there is no dead code or unreachable code. Click
here for more examples of dead code or unreachable code.
There must be no unused variables in your code, i.e variables that are declared and initialized in your
code, but the values stored in those variables are not used anywhere else in your code.
There must be no unused import statement, for example, in a .java file, if the Scanner class is imported
using the statement import java.util.Scanner, however, the Scanner class is not used in that
.java file at all, then the import java.util.Scanner is an unused import statement.
You need to avoid magic numbers in your code, use constants instead. Click here for more examples.
The use of static methods is allowed. However, you need to be well aware of the usage of both static
and instance methods and only use static methods and static variables if you have valid reasons to do
so. You need to add implementation comments in your code to explain the reasons you use any static
methods and static variables.
When handling exceptions in your code, you need to catch more specific exception types, rather than
just catching Exception, I already explained this point in Week 3, you can also click here for an
example (especially section 5. Catch the Most Specific Exception First).
What you need to do
Your task is to implement a software named RentManager to manage the renting of items by members in a
youth club. There are 2 types of items for rent, bicycles and electric scooters.
The RentManager software is a console-based application which allows the employee of the youth club to
manage all renting-related tasks via menus running on the console. The program also has the capability to
save all data to a text file and read data from a text file using a data format described later in this specification.
All interactions with the software will be via console inputs and outputs.
To implement the system, you need to write Java code from the information provided in this specification.
https://www.oracle.com/java/technologies/javase/codeconventions-namingconventions.html
https://www.oracle.com/java/technologies/javase/codeconventions-comments.html
https://howtodoinjava.com/java/puzzles/dead-code-and-unreachable-code-in-java-puzzle
https://www.inf.unibz.it/~calvanese/teaching/04-05-ip/lecture-notes/uni04/node15.html
https://stackify.com/best-practices-exceptions-java/
The inheritance hierarchy of rental items
The relationships between rental items need to be implemented using inheritance as shown below.
The RentalItem superclass
To implement an inheritance hierarchy, you need to create a superclass named RentalItem and two
sub-classes called Bicycle and Scooter.
Following are the common characteristics of all rental items:
● Item id: a string which uniquely identifies each item. The RentManager system must generate a unique
id for each newly added item and the validation of item id according to the following rules:
○ A bicycle id must begin with the character 'b' followed by a three-digit, zero-padding number.
The first bicycle added to the system has id b001, the subsequent bicycles have id b002, b003,
b004, b005…
○ An electric scooter id must begin with the character 's' followed by a three-digit, zero-padding
number. The first electric scooter added to the system will have id s001, the subsequent electric
scooter will have ids s002, s003, s004, s005…
● Description: a short description with maximum 15 words to give more information about the item, for
example, a rental bicycle description like "a versatile hardtail mountain bike capable for basic off road
riding".
● Maximum rent period: the maximum number of days an item can be rented by a renter
○ When an item is returned within this time limit, the renter will pay a standard rental fee (more
details about the standard rental fee are shown below)
○ When an item is returned late, i.e. after the maximum rent period is over, the renter will have to
pay a late fee in addition to the standard rental fee (more details about the late fee are shown
below)
● Standard rental fee: not a daily rate, but this is a fee to rent the item over the maximum rent period.
Even when a renter returns an item earlier than the maximum rent period, the renter will still have to
pay in full this standard rental fee. Each type of item has different specifications about the standard
rental fee. More details in the sections below.
● Daily late fee: the extra charge over each late day. When an item is returned late, i.e. a number of
days later than the maximum rent period, the total late fee is calculated by multiplying this daily late fee
with the number of late days. Each type of item has different specifications about the daily late fee.
More details in the sections below.
● Status: indicates whether the item is currently available for rent or being rented. For simplicity, we use
two values for status: i.e. Available, Rented which correspond to whether the item is available or is
being rented.
The Bicycle subclass
The Bicycle class is a subclass of the RentalItem class to store information about bicycles for rent in the youth
club. More information about bicycles for rent is shown below:
● Each bicycle has a frame size value of either XS, SM, MD, LG, or XL, click here for more information
about the meaning of each value
● A bicycle has a standard rental fee of $10 during a maximum rent period of 3 days
● A bicycle has a daily late fee of $5
Some examples renting and returning bicycles
● A bicycle was rented and returned 2 days later
○ This bicycle was rented and returned within the maximum rent period specified above, hence
the rental cost is $10 and there is no late fee.
● A bicycle was rented and returned 5 days later (2 days late)
○ This bicycle was rented and returned 2 days late, hence:
■ late fee = number of late days * daily late fee = 2 * 5 = $10
■ total rental cost = standard rental fee + late fee = 10 + 10 = $20
The Scooter subclass
The Scooter class is a subclass of the RentalItem class to store information about electric scooters for rent in
the youth club.
● Each electric scooter in the youth club has a battery capacity, which is an integer value in the range
from 250 to 300. The unit is Wh (Watt-hour)
● The maximum rent period of an electric scooter is 2 days
● Over the maximum rent period, the standard rental fee of an electric scooter is either $14 or $19. This
value will be specified when the scooter object is created in the system (more details about creating
rental items are shown in later sections)
● The daily late fee of a scooter is at 75% of the standard rental fee of that scooter, for example, if a
scooter has a standard rental fee of $19, then it's daily late fee is 19 * 0.75 = $14.25
Some examples renting and returning electric scooters
● A scooter (with a standard rental fee of $14) was rented and returned 2 days later.
○ This scooter was rented and returned within the maximum rent period specified above, hence
the rental cost is $14 and there is no late fee.
https://drive.google.com/file/d/11RuzDgTfRoJB7MJPwfKuWmxgwmYUsBL1/view?usp=sharing
● A scooter (with a standard rental fee of $19) was rented and returned 6 days later (4 days late)
○ This scooter was rented and returned 4 days late, hence:
■ daily late fee = 75% of standard rental fee = 0.75 * 19 = $14.25
■ late fee = number of late days * daily late fee = 4 * 14.25 = $57
■ total rental cost = standard rental fee + late fee = 19 + 57 = $76
Design and implementation requirements of the inheritance hierarchy
Based on the information shown above, you are required to design and implement the inheritance hierarchy
with the superclass RentalItem and two subclasses Bicycle and Scooter.
Each class must have appropriate instance variables, constants, constructors and methods. Your class design
and implementation must meet the following requirements:
● Maximum encapsulation
● Promote code reuse by using inheritance and cohesive methods.
● Method overriding and polymorphism
● Code duplication should be avoided.
You will need to decide the most appropriate data types and scope for all attributes, parameters, constructors
and methods. Getter and setter methods should not be written arbitrarily for all variables. Only include a getter
and setter method if you use it within your program.
Youth Club Members - Implementation Requirements
The members of the youth club can rent and return items such as bicycles and electric scooters. You need to
design and implement at least one class to store the following information about the youth club members.
● Member id: a unique string to identify a member. The member id must begin with characters 'MEM'
followed by a three-digit, zero-padding number. The first member has id MEM001, the subsequent
members have ids MEM002, MEM003, MEM004… The system is responsible for validating member
ids according to this rule.
● Member name: a string with at least one character in length.
● Membership type: there are two types of membership, i.e. Standard and Premium.
● Member rental credit: a dollar amount which must be added upfront when a new member joins the
youth club and can be topped up any time later. When a member rents an item in the youth club, this
rental credit is used to cover the total rental cost of the item.
Note: for the sake of simplicity, no need to store member address and date of birth in this system. You
can assume that the youth club already has such information.
When adding rental credit for a new member or topping up rental credit of an existing member, the system
must enforce the following rules:
● A Standard member must add or top up a dollar amount so that their rental credit reaches at least $10.
● A Premium member must add or top up a dollar amount so that their rental credit reaches at least $20.
Note: for the sake of simplicity, each member has a fixed membership type, no need to implement
membership upgrading (from Standard to Premium) or downgrading (from Premium to Standard).
Rules about renting and returning items
When a member rents an item, the following rules must be enforced by the system:
● When a member requests to rent an item, the system must check if a member has enough rental credit
to cover the standard rental fee of the item before allowing the member to rent the item.
● When a member is allowed by the system to rent the item, the system will immediately deduct the
standard rental fee of the item from the rental credit of the member. The late fee (if there is any) will be
deducted later when the member returns the item.
● A member can rent at most two items simultaneously.
When a member returns an item, the following rules must be enforced by the system:
● A Premium member can return an item even when the return will result in a negative rental credit of
that member because of a late fee. However, the member won't be able to borrow any more items until
they top up an amount which is enough to pay back the debt and make their rental credit reach at least
$20 as required above.
○ Example: a premium member currently has $5 left in their rental credit and is returning an item
with a late fee of $57. The system should accept the return of this item and update the rental
credit of the member to a negative amount, i.e. $5 - $57 = - $52 (negative $52). This member
will need to top up an amount of at least 20 - (- 52) = $72 to continue renting more items.
● A standard member rental credit will not be allowed to become negative in any circumstance. If a
standard member is returning an item late and their current rental credit is not enough to cover the late
fee, the system will require the member to immediately pay a dollar amount enough to cover the late
fee and make the rental credit go back to the minimum $10 as shown above.
○ Example: same scenario as in the previous example above, but this time the member is a
standard member who currently has $5 rental credit and the late fee of this return is $57. The
system will require the member to pay a total of $62 immediately, i.e. ($57 to cover the late fee
and another $5 to make the rental credit return to $10)
Program architecture
You are required to implement the components as shown in the following diagram. (Click here to access the
larger diagram)
Requirements:
● One class for the view component, i.e the ConsoleView class and
● One class for the controller component, the ConsoleViewController class.
● At least 5 classes in the model as shown in the diagram. You're allowed to add more classes to the
model to improve the cohesiveness of your classes and promote code reuse.
● There must be at least 3 packages in your code, a view package to store view code, a controller
package to store controller code and a model package to store model code.
The ConsoleView should only have a reference to the ConsoleViewController class and only make method
calls to this class. The view should not directly access the main classes in the model.
The ConsoleViewController class should have a reference to the RentalDataModel class which is responsible
for managing the rental items and members. The controller class can access the other classes in the model,
but this access should be kept to a minimum.
The view should handle all the inputs and outputs. It then gives the user input data to the controller which will
pass it to the model, i.e the RentalDataModel class for further validation and processing operations. The
results of such operations will be passed from the RentalDataModel class back to the ConsoleViewController
class which will give it to the ConsoleView class to display.
To promote the use of inheritance and polymorphism, in the RentalDataModel, all Bicycle and Scooter objects
must be kept in a single array of type RentalItem which has a capacity to store 50 references to objects of both
types. The RentalDataModel also has a single array to store up to 50 references to Member objects.
https://drive.google.com/file/d/11YPCMgObj0N92phDqutiL832rERHUpzu/view?usp=sharing
Main Menu
The RentManager system must present the following menu which will be used by staff of the youth club to
manage the club members and the renting of items.
**** RentManager MAIN MENU ****
1. Add Item
2. Add Member
3. Add rental credit for a member
4. Rent Item
5. Return Item
6. Print all items
7. Print all members
8. Load data from a text file
9. Exit
Enter your choice (1-9):
The user should be able to enter a number from the menu above to select the corresponding option. If the
input is outside of that range, an error message should be displayed and the main menu should be
re-displayed.
When a valid number is entered, your program should execute the corresponding feature and then return to
the main menu. Your program should only stop execution when the user selects the Exit option.
Before describing more details about the functionalities correspond to each menu item, there are some
common requirements which are shown below:
● All inputs must be validated. When there is an invalid input, the system will repeatedly ask the user to
re-enter that input until a valid input is entered. The system must not crash unexpectedly in all
circumstances.
● All exceptions must be caught and handled appropriately. When an exception is caught, the message
displayed in the Console should be a user-friendly message, rather than the built-in technical
messages contained in the exception objects.
● Assume that all currency values have 2 decimal places.
● All date values must be in the format dd/mm/yyyy. Note: You can assume that the user will enter a valid
day value. However, validations are required for the month values (from 1 to 12) and the year value (to
make it simple, only the year value 2022 is allowed). The system needs to validate to ensure that a
return date is after the rent date.
● Source code of the DateTime.java is provided. Please click here to access the code. Some examples
of how to use the DateTime.java class are in the DateTimeTest.java here.
○ Note: You are not allowed to modify the code in the given DateTime.java class. However, if you
want to add your own date time code, you are allowed to use inheritance, i.e. creating your own
subclass of the DateTime.java class and use that subclass in your implementation.
● In all situations, the system must notify the user with detailed feedback messages to let the user know
about the situations.
https://drive.google.com/file/d/16W__biL4pxRoUNDCEOmqlelkJbQ8gTtP/view?usp=sharing
https://drive.google.com/file/d/16jDkSJ7t5RUENR1WjGivNYGlFH1L7Hka/view?usp=sharing
Add Item
The user (staff at the youth club) selects this menu entry to add a new item for rent to the RentManager
system. As there are two types of items, i.e. Bicycle and Scooter, the system can provide a sub-menu for the
user to add a bicycle or a scooter. For each type of item, the system will prompt the user to enter all details
necessary to create the item. Please refer to the previous section, "The inheritance hierarchy of rental items"
for more details about the information a user will need to enter to create new items.
The following points are applied to all items:
● The user will not need to enter a new item id. It will be generated by the system when an item is
successfully created. The id of the new item will need to be shown to the user in a confirmation
message when the item is successfully added to the system.
● When a new item is successfully added to the system, its status is set to Available by the system.
To create a new rental bicycle, the user will need to enter the following information to the system:
● Description
● Maximum rent period
● Standard rental fee
● Daily late fee
● Frame size
To create a new rental electric scooter, the user will need to enter the following information to the system:
● Description
● Maximum rent period
● Standard rental fee
● Battery capacity
The daily late fee of a scooter will be calculated by the system based on the standard rental fee
entered by the user. The rule to calculate daily late fee was specified in the "Scooter subclass" section.
The system must validate user inputs in all situations and give detailed feedback to let the user know about
any error or exceptional cases.
When an item is successfully added, the system will print a confirmation message with the id of the new item
to let the user know.
Add Member
The user (staff at the youth club) selects this menu entry to add information of a new youth club member to the
RentManager system. The system will prompt the user to enter all details necessary to create a new member.
Please refer to the previous section "Youth Club Members - Implementation Requirements" for more details
about the information related to a member.
To create a new member, the user will need to enter the following information to the system:
● Member name
● Membership type
● Member rental credit
The user will not need to enter a new member id. It will be generated by the system when a new member is
successfully created. The id of the new member will need to be shown to the user in a confirmation message
when the member is successfully added to the system.
The system must validate user inputs in all situations and give detailed feedback to let the user know about
any error or exceptional cases.
When a member is successfully added, the system will print a confirmation message with the id of the new
member to let the user know.
Add rental credit for a member
The user (staff at the youth club) selects this menu entry to add more rental credit for an existing member. The
system will prompt the user to enter a member id. If a member is found, the system will prompt the user to
enter a dollar amount (up to 2 decimal places) to add to the existing rental credit of the member.
Please refer to the previous section "Youth Club Members - Implementation Requirements" for a more detailed
description of the rules about adding rental credit for a member.
The system must validate user inputs in all situations and give detailed feedback to let the user know about
any error or exceptional cases.
When a member rental credit is successfully updated, the system must print a confirmation message with the
updated rental credit to let the user know.
Rent Item
The user (staff at the youth club) selects this menu entry when a member wants to rent an item. The system
will prompt the user to enter an item id and id of the member who wants to rent the item. The system needs to
check all user inputs and only allows the member to rent the item when all conditions are met. Please refer to
previous sections, especially the section "Rules about renting and returning items" for more detailed
descriptions of such conditions.
When a rent of an item is not successful, the system must notify the user with detailed messages to let the
user know about the reasons why a renting is not successful.
When a member is eligible to rent the item, the system will prompt the user to enter the rent date in
dd/mm/yyyy format.
When a rent is successful, the system must print a confirmation message to let the user know that the item has
been successfully rented by the member and print the updated rental credit of the member together with the
expected return date. Again, please refer to previous sections, especially the section "Rules about renting and
returning items" for more examples about renting an item.
Return Item
The user (staff at the youth club) selects this menu entry when a member wants to return an item. The system
will prompt the user to enter an item id and id of the member who wants to return the item together with a
return date in dd/mm/yyyy format.
The system needs to check all user inputs and ensure all return conditions are met. Please refer to previous
sections, especially the section "Rules about renting and returning items" for more detailed descriptions of
such conditions.
When a return is successful, the system must print a confirmation message to let the user know that the item
has been returned successfully. If there is a late fee, the system will display a message to let the user know
about the late fee as well as the updated rental credit of the member. Again, please refer to previous sections,
especially the section "Rules about renting and returning items" for more examples about returning an item.
Print all items
The user (staff at the youth club) selects this menu entry to display all rental items managed by the
RentManager system. The rental records of each item will also need to be displayed. In this assignment, the
system needs to display the 3 most recent rental records for each item.
For each item, the system prints to the Console all information about the item followed by all information about
up to 3 most recent rental records of that item.
Note: when printing to the Console, your program needs to print the details in the format as shown in the
following sample out.
● Click here to access the sample outputs when printing all items.
Print all members
The user (staff at the youth club) selects this menu entry to display all youth club members managed by the
RentManager system. The rental records of each member will also need to be displayed. In this assignment,
the system needs to display the 3 most recent rental records for each member.
For each member, the system prints to the Console all information about the member followed by all
information about up to 3 most recent rental records of that member.
Note: when printing to the Console, your program needs to print the details in the format as shown in the
following sample out.
● Click here to access the sample outputs when printing all members.
Save all data to a text file
This feature is not available in the main menu because it will be executed automatically by the system any time
a user (staff at the youth club) has finished an interaction with the main menu to add or update data.
The RentManager system needs to automatically save all data to a text file named output.txt which is located
in the main project folder whenever there is a change in the existing data managed by the system, specifically
in cases such as when a user has finished adding a new member or item, adding rental credit for an existing
member, renting an item, returning an item…
When writing to a text file, details of each rental item, each member, and each rental record of an item will
need to be converted to the following String representations.
https://docs.google.com/document/d/1rxC4xVUyaTVhQyqNY6XoOtVEv2F9U6T2c3vp0vkUeSw/edit?usp=sharing
https://docs.google.com/document/d/1eeIUIIQHk3PiuLul7IC38FyzlDT835N8xg41KMDZNm0/edit?usp=sharing
Note: you need to implement the String representations using the formats shown below:
● In a string representation, the colon (:) is used as a separator
● Date format: dd/mm/yyyy
● A currency value has two decimal places
The String representation of a bicycle:
ID:Description:Max rent period:Standard rental fee:Daily late fee:Status:Frame size
The String representation of an electric scooter:
ID:Description:Max rent period:Standard rental fee:Daily late fee:Status:Battery capacity
The String representation of a rental record of an item
Renter id:Rent date:Return date:Total rental fee
The String representation of a member of the youth club
ID:Name:Type:Rental credit
Output text file format
The output.txt text file is split into two sections. The first section has the title -- ITEMS -- and the second
section has the title -- MEMBERS --
In the -- ITEMS -- section, for each item, print the String representation of the item on a single line. If the item
has rental records, print the latest rental record on the next line, then the second and third latest rental records
on the subsequent lines. Only keep the three most recent rental records including the incomplete record if the
item is being rented. If a return date or a total rental fee is not yet known, print the String none. After finishing
printing the data of one item, move to the next line and repeat the process above to print the data of the next
rental item to the text file. If an item has no rental record, just print the String representation of that item, then
move to the next line and continue with the next item.
In the -- MEMBERS -- section, print the String representation of each member on a separate line. Do not keep
the rental records of each member in the text file. You are supposed to write code to recreate rental records of
a member from the rental records of the items in the previous sections.
In the following sample output.txt file, there are 3 items. The first item (bicycle) has 3 rental records. The
second item (scooter) has no rental record and the third item (scooter) has 1 rental record. There are 4
members stored in the file.
output.txt example:
-- ITEMS --
b001:a mountain bike for off road riding:3:10.00:5.00:Rented:MD
MEM006:20/05/2022:none:none
MEM008:10/05/2022:15/05/2022:20.00
MEM003:30/04/2022:03/05/2022:10.00
s003:very easy to charge, fold and unfold:2:14.00:10.50:Available:250
s001:solid and comfortable to ride:2:19.00:14.25:Rented:280
MEM016:26/05/2022:none:none
-- MEMBERS --
MEM003:John Doe:Premium:50.00
MEM006:Jimmy Lee:Standard:10.00
MEM008:Jane Doe:Premium:65.00
MEM016:Peter Pike:Standard:25.00
Load data from a text file
The user (staff at the youth club) selects this menu entry to load data from a text file to an empty RentManager
program. The system needs to allow the user to specify a file name (the user will not need to specify any
absolute or relative path). The system will locate the corresponding file in the main project folder and read all
items, members and rental records data in that file to the system. The name of the text file must be specified
by the user via Console input.
Note:
● File name requirement: the system must validate user input to make sure that a file name entered by a
user has at least 3 characters for the name and must end with the extension ".txt". For example, the
name "in.dat" is not valid, but the name "input.txt" is a valid file name.
● When testing your implementation of this feature, we will use our own data file containing different data
but in a similar format as shown in the previous section.
When loading data from a text file, the system must check and avoid any duplication. There must be no
duplication of any data item in the system.
The system must validate all inputs and show appropriate error messages to users, for example, in cases such
as when a given file name is invalid, a file does not exist, invalid data format or duplication of data… and any
other exceptional or error cases.
Please refer to the data file example shown in the "Save all data to a text file" section above.
Exit
When the user (staff at the youth club) selects this menu entry, the RentManager program will stop execution
with a message "Quitting…Done!" to indicate that the execution has stopped successfully. You must make
sure this is the only way the user can quit the program. In any other cases, for example, in cases when the
program encounters invalid inputs, the program must continue execution.
Report
You need to include a short report in pdf format explaining how polymorphism is implemented in your
application. Your explanation needs to be specific, with polymorphism examples from your code. The report
should be no more than 2 pages.
Include the pdf report in the zip file of your final submission.
THE END
There are no answers to this question.
Login to buy an answer or post yours. You can also vote on other
others
Get Help With a similar task to - Java assgiment help and tutoring
Related Questions
Similar orders to
Java assgiment help and tutoring
Tutlance Experts offer help in a wide range of topics. Here are some
of our top services:
- Online writing help
- Online homework help
- Personal statement help
- Essay writing help
- Research paper help
- Term paper help
- Do my homework
- Online assignment help
- Online class help
- Dissertation help
- Thesis help
- Proofreading and editing help
- Lab report writing help
- Case study writing help
- White paper writing help
- Letter writing help
- Resume writing help
Post your project now for free and watch professional experts outbid each other in just a few minutes.