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
Write down the result of each expression in the output column and specify the datatype of the result.Datatype should follow the
sergiy2304 [10]

Answer:

Kindly check the explanation section.

Explanation:

Below are the expression given in the question and the corresponding output and Datatype.

(1). Expression = 7/2 + 9.2/2.

Output = 7.6, Datatype = double

(2). Expression = 3.4 + 2 5 f.

Output = 5.9, Datatype = double.

(3). Expression = "whale" . Substring (2,5).

Output = "ale" , Datatype = string.

(4). Expression= (int) 9.2 + 6.0 f.

Output = 15.0 f, Datatype = float.

(5). Expression = (2 <= 1) && (5! = 2) || (8 + 5!= 13).

Output = false, Datatype = boolean

(6) Expression =1.5 f == 1.5?.

Output: “false” , Datatype : “true ”

Output = “false”,

Datatype= String.

(7). Expression = “joey”.charAtt(4).

Output = error, Datatype = error“.

(8). Expression = madmax”.

indexOf(“a”) + 7.

Output: 8 , Datatype = int.

(9). Expression = 2 + 3 + “catdog” + 1 + 2.

Output = “5catdog12”, Datatype = String.

(10). Expression = String.format(“%3.3f”,7.89672).

output = “7.897”, datatype = String.

(11). Expression = “captain”.indexOf(“a”, 2).

Output = 4, datatype = int.

(12). true ? ++3: 3++.

Output = error, dataty = error.

(13). Expression = new String[]{“tony”,“josh”}[0].

Output = “tony”, Datatype = String.

(14). Expression = “patrick”.substring(2) +“lucky”.substring(4).

Output = “tricky”, Datatype = String.

(15). Expression = “popFizz”.indexOf(“o”) + 2.4+ 6L.

Output9.4, Datatype = double.

(16). Expression = “pizza”.indexOf(“z”).

Output = 2, Datatype = int.

3 0
3 years ago
Careers on the largest declining industries list will see an increase in the number of employees in their workforce.
IrinaK [193]

The answer is False.

The word "declining" means going down. So, in this case, the employees would go down or leave.

7 0
3 years ago
In portrait mode, your camera will use what?
vesna_86 [32]

Answer:

A. A Smaller Aperture

Have A Good Day

3 0
3 years ago
I'm doing a python assignment for my coding class, and the input part just isn't working, someone please help out and tell me wh
tigry1 [53]

,.....,.........mm malds quería saber

8 0
2 years ago
Consider a relation about people in the United States, including their name, Social Security number, street address, city, state
andreyandreev [35.5K]

Answer:

For constructing relational schema, consider the relation as:

Data Attributes for USPeople: name, Social Security number (SSN), street address, city, state,

ZIP code, area code, phone number

1. Functional Dependency (FD):

A functional dependency (FD) is a relationship between the primary key and non-key attributes of  the relation. For finding FD, we need to know about the primary key (PK) which should be unique.

Social Security number (SSN) is the only attribute that holds unique value for relation. R, attribute for any relation Y is functionally dependent on attribute X (usually the PK), if for every  valid instance of X, that value of X uniquely determines the value of Y.

Social Security number (PK) ->;name, street address, city, state, ZIP code, area code, phone  number

2. keys for the relation

Primary key = Social Security Number (PK)

Foreign key = Area code

In the normalization process, we can separate address table (street address, city, state, ZIP  code, area code)

Can an area code straddle two states?

Yes, it can straddle between two states; it might be in cities/regions that “lie” across two states.  For example, Kansas City is in Missouri and Kansas. A lot of people share the same area code.

Can a ZIP code straddle two area codes?

Yes, it can straddle between two states; it might be in cities/regions that “lie” across two states.

Can same Social Security number is allotted to two people?

NO, everyone has a unique SSN number.

Can peoples living together have the same address or phone number?

Yes, people living in the same house share addresses or phone numbers.

4 0
3 years ago
Other questions:
  • Write a program whose input is two integers and whose output is the two integers swapped. Place the values in an array, where x
    12·1 answer
  • In tableData the column variable of the first column should be RowerNames, the second RowingEvent, the third RowerWeight and the
    6·1 answer
  • T<br> F<br> 5.<br> You can save presentations in PDF and XPS formats.
    14·1 answer
  • What is the ratio between total bits required for such a cache implementation over the data storage bits?
    10·1 answer
  • To transfer data packets between two or more networks, a ________ is used.
    11·1 answer
  • What are the five layers in the internet protocol stack? What are the principal responsibilities of each of these lay?
    9·1 answer
  • Which of the following demonstrates the proper way to specify a variable-length argument list?
    7·1 answer
  • Your _______ can help block inappropriate content online.<br> 1. web browser<br> 2. Password
    14·1 answer
  • Which of the following binary numbers is equivalent to decimal 4?
    8·2 answers
  • The Backstage view is where you can see information and options pertaining to the user account and settings. How is the Backstag
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!