Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i am stuck with this question Write an enum class called PaymentType with values CASH, DEBIT_CARD, CREDIT CARD, CHECK. More enum information can be found

image text in transcribedimage text in transcribedimage text in transcribedi am stuck with this question

Write an enum class called PaymentType with values CASH, DEBIT_CARD, CREDIT CARD, CHECK. More enum information can be found here: https://docs.oracle.com/javase/tutorial/java/javaOO/enum.html Create a new class called Payment. This class should have two private members: PaymentType type and double amount. The class should have one constructor that accepts two parameters and sets the fields to the parameters. Write getter and setter methods for each private field. Write a method called takePayment() in the Transaction class. This method should ask the user two things: 1) what type of payment they want to use, and 2) how much they will pay with that payment type. The method should continuously ask the user these questions until they enter enough money to cover the total. You can assume that the user enters double values. The format should be like the following: Please enter payment type. 1. Cash 2. Debit card 3. Credit card 4. Check" Then your program should ask the user how much they will pay with that payment type: Enter the amount to pay with this type." Then your program should do the following: 1) Create a Payment object with the information (type and amount). 2) Add the Payment object to the Transaction's ArrayList

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

More Books

Students also viewed these Databases questions