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
What programming language has dominated scientific computing over the past 60 years?
lord [1]

c++,  because it is considered as the mother of all programming languages. you can easily access other programming languages if you have a command on c++

7 0
1 year ago
Question 1
Alexxandr [17]

Explanation:

so, what do you think ?

I am sure you have used a computer or a smart phone yourself.

how many clicks or taps do you want to do before you you get what you were looking for ?

hmmmm ?

as few a possible, right ?

ideally, of course, this is one (1) click or tap.

7 0
2 years ago
During email encryption, the system creates which type of key to allow the user to send an encrypted email?
kiruha [24]
A hope this is correct just read an article on it
5 0
3 years ago
Read 2 more answers
How to install windows 11 on unsupported processor
alexgriva [62]

Answer: You can't, if you anyway bypass the system, your device will run on risk.

Suggestion: Use any Linux distro similar windows 11. Like - Ubuntu/ Linux Mint/ ElementaryOs.

(Suggestion is only for if you can't run windows 10 or the pre installed Operating System in your machine.)

4 0
3 years ago
When a program has several modules calling other modules, programmers often use a program ____, which operates similarly to an o
maw [93]

Answer:

hierarchy chart

Explanation:

Based on the information provided within the question it can be said that in this scenario programmers usually use a hierarchy chart. This is a chart that shows the relationship that exists between various different modules that are able to call on another. Therefore showing the programmers the organization of the entire overall program.

3 0
3 years ago
Other questions:
  • Which utility would you use to test communication on your own computer using your ip address as a parameter?
    10·1 answer
  • A program called the ______ combines the object program with other programs in the library and is used in the program to create
    5·1 answer
  • How do I change my keyboard's debounce time?
    15·2 answers
  • I don't understand how to write code for this in Java using nested for loops only. The official question is: write a program tha
    8·1 answer
  • When Liam went to print his presentation, the boot process established the connection to the printer, sent the presentation to t
    12·1 answer
  • Write an if/else statement that compares the value of the variables soldYesterday and soldToday, and based upon that comparison
    15·1 answer
  • Please its argent and I will give you BRAINLIEST ANSWER 6. How would you confirm that a colourless liquid given to you is pure w
    10·1 answer
  • Help me with the question please..​
    6·1 answer
  • ¿Por qué disminuyó el tamaño de la población de caribús? Usa la evidencia inicial para explicar por qué disminuyó el tamaño de l
    5·1 answer
  • How to add a legend to a graph in excel?
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!