Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I don't know how to have these 2 classes work together. (in Java please) B.1 Expense Class Implement Expense class inside a package called expenses

I don't know how to have these 2 classes work together. (in Java please)

image text in transcribed

B.1 Expense Class Implement Expense class inside a package called expenses that contains: A private String data field service Type, e.g. "Electricity", "Gas, etc. A private String data field billDate, e.g. "Jan 4 2021". A private double (or Double) data field billAmount, e.g. 25.00. A private String data field dueDate, e.g. "Jan 30 2021". A private String data field payment Date .e.g. "Jan 20 2021". A private String data field paymentForm, e.g. "Credit Card", "Check, etc. A private String data field paymentRefNumber, e.g. 123456, etc. (Do not use your real reference information. The number may be composed of year, month, day, and any additional number, e.g. 20210101-9") A private double (or Double) data field named paymentAmount, e.g. 10.00. A private double (or Double) data field named balanceAmount, computing the difference between the billAmount and the paymentAmount for the expense. Methods that set and return the values for each variable. Note that for balanceAmount there should only be a "get" method, and not a "set" method. A constructor method receiving all the arguments required to create each expense. A print method printing the values of all variables in the class. B.2 MyExpenses Class Implement MyExpenses class inside a package called expenses that contains: An array called myExpenses where all expense objects are stored. An "init method where all expense objects are created. Each expense object needs to be stored in myExpenses array. All expense values need to be passed as 1 arguments when constructing each expense object. You need to include at least 5 different expense objects. A "print" method printing all the attributes for each expense object, the total amount of expenses and the total balance. The "main" method that calls the init and print methods

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 Systems Design Implementation And Management

Authors: Peter Rob, Carlos Coronel

6th International Edition

061921323X, 978-0619213237

More Books

Students also viewed these Databases questions

Question

Who are the primary participants in a start-ups new-venture team?

Answered: 1 week ago

Question

What is a verb?

Answered: 1 week ago