2. values. Save the application as TestSandwich.java. prompts the user for data, instantiates one Sandwich 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 default 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 addPet Fee () 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 named leasel, lease2, lease3, and lease4. Create a getData() method that prompts a user for values for each field for a Lease, and return a newly constructed Lease object to the main () method, where it is assigned to one of main () 's first three Lease objects. Do not prompt the user for values for the fourth Lease object, but let it hold the default values. After the four Lease objects have been assigned values, pass the leasel object to a showValues () method that displays the data. Then call the addPet Fee () method with the leasel object, and confirm that the fee explanation statement is displayed. Next, call the showValues () method for the leasel 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 three hold the values you supplied as input and one holds the constructor default values. Save the application as TestLease.java.
2. values. Save the application as TestSandwich.java. prompts the user for data, instantiates one Sandwich 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 default 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 addPet Fee () 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 named leasel, lease2, lease3, and lease4. Create a getData() method that prompts a user for values for each field for a Lease, and return a newly constructed Lease object to the main () method, where it is assigned to one of main () 's first three Lease objects. Do not prompt the user for values for the fourth Lease object, but let it hold the default values. After the four Lease objects have been assigned values, pass the leasel object to a showValues () method that displays the data. Then call the addPet Fee () method with the leasel object, and confirm that the fee explanation statement is displayed. Next, call the showValues () method for the leasel 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 three hold the values you supplied as input and one holds the constructor default values. Save the application as TestLease.java.
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
100%
Java Programming Eclipse IDE
Question 2, a and b. Help would be appreciated, Having trouble figuring this out.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY