Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please solution this java project Clearlyyy Given uml and do the following: 1 - Create class / interface that implements the classes + interface displayed

Please solution this java project Clearlyyy Given uml and do the following:1- Create class/interface that implements the classes + interface displayed in the UML displayed above exactly as specified (same variable names, types, ). Make sure to include no-arg + all field constructors, setters + getters, as well as toString() methods in each of the classes created. Please note the following:a- method calculatePayment()is implemented differently in each of the concrete classes as follows:- in class Cash it is calculated as the payment amount entered minus the discountRate percentage (e.g. if amount is 200.0 and discountRate is 11.0 then payment value is 178.0)- in class Check, payment is the same as the amount entered.- in class CreditCard, payment is the amount plus the chargingFee.b- method printPaymentInfo() prints the properties and the calculated payment by calling both the toString() as well as the calculatePayment() methods. c- class CustomerPayment is Comparable based on the value returned by the method calculatePayment().d- Check class has a variable called type (int) which is set using one of three constant values that should be defined in the class ( CASHIER=1, CERTIFIED=2, PERSONAL=3).e- classes Check and CreditCard implement interface Payable by implementing the method isAuthorized() as follows:- A Check payment is authorized if either the type of the check is CASHIER or if the amount of the payment is less than or equal to the accountBalance, otherwise it is not authorized. - A CreditCard payment is authorized if its expiryDate is less than or equal to the current date.2- Create a Driver class that does the following:- Creates an ArrayList of type CustomerPayment and adds different types of payments to it (Cash, Check, CreditCard). Check or CreditCard payments should be checked if they are authorized before adding them to the list. If they are not authorized, they should not be added to the list. Make sure to deduct the amount of authorized Check payments (CERTIFIED and PERSONAL only) from the accountBalance before adding them to the list ( use the method deductAmountFromBalance()).- Sorts the ArrayList created (use Collections.sort) in descending order based on the calculated payment. After sorting you should print the list to the screen using the printPaymentInfo() method.Your all field constructors should use EXACTLY the following format and order:CustomerPayment ( customerName, customerId, amount )Cash ( customerName, customerId, amount, discountRate )Check ( customerName, customerId, amount, accountNumber, accountBalance, type)CreditCard ( customerName, customerId, amount, chargingFee, expiryDate)Sample Run:Assume you try to add the following payments to your list:new Check("Rana",7777,400,1111,350,Check.PERSONAL); new Cash("Ahmad",4444,150,5.0);new Check("Suha",5555,100,1111,200,Check.CASHIER) ; new Check("Rania",7777,600.0,1111,750,Check.CERTIFIED); new CreditCard("Randa",9999,170,20, new Date(124,05,03)); new CreditCard("Hani",6666,150,10, new Date(120,06,07));Then the output of your program should be very similar to the following:Check [accountNumber=1111, accountBalance=150.0, type=2, customerName=Rania, customerId=7777, amount=600.0] Payment =600.0CreditCard [chargingFee=20.0, expiryDate=Mon Jun 0300:00:00 IDT 2024, customerName=Randa, customerId=9999, amount=170.0] Payment =190.0Cash [discountRate=5.0, customerName=Ahmad, customerId=4444, amount=150.0] Payment =142.5Check [accountNumber=1111, accountBalance=200.0, type=1, customerName=Suha, customerId=5555, amount=100.0] Payment =100.0Please note the following modification in the following statement in the project description:ACreditCardpayment is authorized if itsexpiryDateislessthan or equal to the current date.The wordlessabove should be replaced by the wordgreater.Other notes:- You should use the Comparable interface already defined by java and not create your own.- You Driver class should include only the main method and you should assume that if your Driver class is replaced by another Driver class that creates a list similar to the example then your program should work fine without any modifications.- As explained in the description, a Check of type CASHIER does NOT subtract the amount from the account balance.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Marketing The Ultimate Marketing Tool

Authors: Edward L. Nash

1st Edition

0070460639, 978-0070460638

More Books

Students also viewed these Databases questions

Question

=+function g such that A[ x (0, 1): f(x) + g(x)]

Answered: 1 week ago

Question

8. Explain the contact hypothesis.

Answered: 1 week ago

Question

7. Identify four antecedents that influence intercultural contact.

Answered: 1 week ago