1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Georgia [21]
3 years ago
13

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 explainPetPolicy() that explains the pet fee. Save the class as Lease.java.
Computers and Technology
1 answer:
natka813 [3]3 years ago
6 0

Answer:

package b4;

public class Lease {

// Declare the necessary instance fields

String tenant_name;

int appartment_number;

double rent_amount;

double lease_term;

// Constructor to initialize the fields to the requested values

public Lease() {

 this.tenant_name = "XXX";

 this.appartment_number = 0;

 this.rent_amount = 1000;

 this.lease_term = 12;

}

// Getter for tenant name

public String getTenant_name() {

 return tenant_name;

}

// Setter for tenant name

public void setTenant_name(String tenant_name) {

 this.tenant_name = tenant_name;

}

// Getter for appartment number

public int getAppartment_number() {

 return appartment_number;

}

// Setter for appartment number

public void setAppartment_number(int appartment_number) {

 this.appartment_number = appartment_number;

}

// Getter for rent amount per month

public double getRent_amount() {

 return rent_amount;

}

// Setter for rent amount per month

public void setRent_amount(double rent_amount) {

 this.rent_amount = rent_amount;

}

// Getter for lease term

public double getLease_term() {

 return lease_term;

}

// Setter for lease term

public void setLease_term(double lease_term) {

 this.lease_term = lease_term;

}

// Non-static method addPetFee

// It adds $10 to the current rent_amount.

// It also calls the static explainPetPolicy method

public void addPetFee() {

 this.rent_amount += 10;

 explainPetPolicy();

}

// The Static explainPetPolicy method

// Please replace the string in the println() method with the actual policy

// statement

public static void explainPetPolicy() {

 System.out.println("Explanation of the pet policy is as follows");

}

}

Explanation:

The actual source code file has been attached to this response. The code has been well commented to aid readability and understandability. Please download the file attached. It has been saved as "Lease.java"

Download java
You might be interested in
Which two statements describe benefits of a block-based coding language
gladu [14]
Answer D and B I think
8 0
2 years ago
Read 2 more answers
What is not an example of a job skill
ikadub [295]

Being dishonest, irresponsible and unpunctual.Answer:

Explanation:

8 0
2 years ago
Read 2 more answers
What is one effect the internet has had on the library
Shkiper50 [21]

Answer:

The internet provides access to an abundance of information from home, making it easier for people to get answers much faster. This efficiency has caused libraries to receive less business and less users, therefore making their service less popular.

7 0
3 years ago
Aaron is staying at a hotel that charges $100 per night plus tax for a room. A tax of 8% is applied to the room rate per day and
DerKrebs [107]

Answer:

We use the Python language to implement the code, if you have and IDE, simply copy and paste the code and run it

Note: the cost function is  c=(R+ .08*d)+5

Explanation:

#initialize some variables

T = 0.08 # tax for each day

F = 5.00 # one time fee

R = 100 # room rate

d = int(input("Enter the number of days stayed at the hotel "))

c = 0 # initialize cost variable

if (d > 0):

   c=(R+ .08*d)+5

   print(" the cost for ", d, " days is ", c )

else:

   print(" Invalid entry for days ", d )

7 0
2 years ago
What are two ways you can open an application?
Aleks04 [339]

Method 1: Press the windows key and add a number to launch the application which is opened quickly on your taskbar.

Method 2: Use the start menu.

Method 3: Use third party launchers.

5 0
2 years ago
Read 2 more answers
Other questions:
  • Manipulate the SQL statement to pull ALL fields and rows from Customers table that have a PostalCode of 44000. TIP: Since Postal
    13·1 answer
  • In a transaction-processing system (TPS), if the TPS database can be queried and updated while the transaction is taking place,
    12·1 answer
  • A beginning driver may tend to oversteer. This means the driver what? Btw Cars are technology so that is why it is under Compute
    11·1 answer
  • Write a while loop that prints userNum divided by 2 (integer division) until reaching 1. Follow each number by a space.
    7·1 answer
  • The software used to help run the computer hardware is the _____.
    9·2 answers
  • What is the average time a caller waits for an operator to answer?
    7·1 answer
  • Cloud computing is an old phenomenon in computing infrastructure dating back to the early days of the Internet that involves mov
    10·1 answer
  • Create a program that finds (n+1)! -factorial- of an integer n in C++.
    13·1 answer
  • 3. Special keys labelled Fl to F12.
    8·1 answer
  • Who plays Pokemon Go if you do put your code in your answer so I can friend you.<br><br><br> o_o
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!