Question: Write a Java program for a pet store to keep track of the following information: - Animal : ID (incremental ID by 1 for each
Write a Java program for a pet store to keep track of the following information:
- Animal: ID (incremental ID by 1 for each animal), Type and Price.
- Sales Order: ID (incremental ID by 1 for each order), Net Amount, VAT, Total Amount, List of Animals, Date and Time of order, name of cashier.
- Cashier: Name, Surname, Username and Password (insert from code five fixed cashiers).
- Manager: Name, Surname, Username and Password (insert from code one fixed manager).
The program must:
Present a Menu for the cashier after he has logged in with username and password.
Menu:
- New Sales Order
- Add an animal in the order,
- Remove an animal from order
- Print information for an order with a certain ID
- Statistics
- Overall number of orders for the cashier with a certain username. (requires manager password)
- Total amount of all orders processed by the cashier with a certain username (requires manager password).
- Total amount of all orders of the current day (requires manager password).
- Change cashier from one to another
- Pass from Cashier to Manager
- Pass from Manager to Cashier
- Exit
Complete the following extensions to the current work
Four classes: Animal, SalesOrder, PetStore, Cashier.
1. For the classes Animal and SalesOrder make sure you use a static int field for the incremental ID of the objects of these classes.
2. The store manager needs to keep track of extra information for the following animals:
a. Dog name, origin
b. Cat color, bites
c. Bird sings
Define the method printInfo() on the Animal class that prints the information of the specific animal.
3. The manager should be able to specify a discount on specific animals. The cashier needs to see the orders: total, discount and total after discount.
4. Introduce inheritance in the project design with the following:
Person class:
The class Person has:
- Name Surname
- ID
- Username
- Password
- Address
- PhoneNumber
Classes inheriting from Person:
I) Manager: has two additional features more than the Person called InternalPhoneNumber and PIN to start the software at the beginning of the day. Every manager has his own PIN to start the software. The start can be made after the manager login.
II) Cashier: has these fields more than Person: InternalPhoneNumber, baseSalary.
III) Customer class
There are these types of customers:
1)SimpleCustomer.
Not eligible for gift points!
2) LoyalCustomer
The customer gets 1 gift point for every EUR spent.
3)CustomerEmployee
The customer gets 2 gift points for every EUR spent.
The cashier must be able to set a customer to the order.
Define a method in the SalesOrder class that calculates the awarded GiftPoints total depending on the customer type of the order.
5. Define two interfaces: Payable and PaymentProcessor.
a)Payable class has two method: getAmountToPay() and getDescription(). These methods should be implemented by the SalesOrder class.
b) In PaymentProcessor interface, define a method to be used in the future to process the payments and will take as parameter an instance of the Payable class.
6. Handle input correctness and check the validity of the input types, strings, int, etc with exceptions.
7. Use ArrayList within the PetStore class to keep all the SalesOrders being currently served. Handle all operations polymorphically.
8. Use ArrayList within SalesOrder to keep the animals of the order.
9. Use ArrayList within the PetStore class to keep all the users currently logged in the system.
10. Define polymorphically the operations that will permit the manager at the end of the day to:
a)Compute the overall sold: amount, discount and amount after discount.
b)Compute the overall amount of gift points awarded for each of the types of customers
c)Compute the overall number of each type of animal purchased
d)Compute the overall amount of VAT accumulated on that day
11. Produce an UML diagram of all the classes in the project.
Start the program with a login window where you request username and password for the user.
Once the user is logged in show the following window with this menu:
- File
- Help (show a simple window with few instructions on how to use the program)
- Exit (close the program)
Suggestion: Use JFrame and JMenu
Put in the File menu the following voices:
- New Order (suggestion: open a new JFrame for a new Order)
- Overall number of orders for the cashier (show a pop-up with the number of orders)
- Total amount of all orders for the cashier (show a pop-up with the amount of orders)
Within the New Order JFrame implement the following:
- Choose a Customer
- Choose animals to add
- Remove Animal
- Print order info
- Save and Close Order
Suggestion: Use JComboBox for the Customer. Use JList for the animals with two buttons Add and Remove. When Add is pressed display the all the animals and select one to add.
Once the user is logged in he can load the previously saved data from a file. To do this he has to select from the menu the option Load Data.
Suggestion: Add a new voice in the main menu called Load Data which will open e new window with JFileChooser. Once the window is opened, the user can select the file where the data should be loaded from.
The user can save the data during the whole execution of the program or before closing the program.
Suggestion: Add a new voice in the main menu called Save Data and perform in this JMenuItem the savings of all the data.
Suggestion on how to save the data: Use serialization and serialize the Orders following the example introduced in class with AccountRecordSerializable.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
