Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

13. a. Create a class named Lease with fields that hold an apartment tenant's name, apartment number, monthly rent amount, and term of the lease

image text in transcribedimage text in transcribed

13. a. Create a class named Lease with fields that hold an apartment tenant's name, apartment number, monthly rent amount, and term of the lease in months. Include a constructor that initializes the name to XXX, the apartment number to 0, the rent to 1000, and the term to 12. Also include methods to get and set each of the fields. Include a nonstatic method named addPetFee() that adds $10 to the monthly rent value and calls a static method named explainPet Policy() that explains the pet fee. Save the class as Lease.java. b. Create a class named TestLease whose main() method declares four Lease objects. Call a getData() method three times. Within the method, prompt a user for values for each field for a Lease, and return a Lease object to the main() method where it is assigned to one of main()'s Lease objects. Do not prompt the user for values for the fourth Lease object, but let it continue to hold the default values. Then, in main(), pass one of the Lease objects to a showValues() method that displays the data. Then call the addPetFee() method using the passed Lease object and confirm that the fee explanation statement is displayed. Next, call the showValues() method for the Lease object again and confirm that the pet fee has been added to the rent. Finally, call the showValues() method with each of the other three objects; confirm that two hold the values you supplied as input and one holds the constructor default values. Save the application as TestLease.java. Please enter Lessee Name: Cheryl Miller Please enter the Apartment Number: 111 Please enter the Monthly Rent Amount: 560.00 Please enter the Lease Term in Months: 12 Please enter Lessee Name: Brooks Thompson Please enter the Apartment Number: 213 Please enter the Monthly Rent Amount: 625.00 Please enter the Lease Term in Months: 6 Please enter Lessee Name: Tom Simmons Please enter the Apartment Number: 145 Please enter the Monthly Rent Amount: 815.00 Please enter the Lease Term in Months: 12 Your lease results: Name : Cheryl Miller Apartment : 111 Rent : 560.0 Term : 12 A pet fee of $10 is addd to the monthly rent. Your lease results: Name : Cheryl Miller Apartment : 111 Rent : 570.0 Term : 12 Your lease results: Name : Brooks Thompson Apartment : 213 Rent : 625.0 Term :6 Your lease results: Name : Tom Simmons Apartment : 145 Rent : 815.0 Term : 12 Name Your lease results: : XXX Apartment : Rent : 1000.0 Term : 12

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

Probabilistic Databases

Authors: Dan Suciu, Dan Olteanu, Christopher Re, Christoph Koch

1st Edition

3031007514, 978-3031007514

More Books

Students also viewed these Databases questions

Question

6. Conduct a cost-benefit analysis for a training program.

Answered: 1 week ago