-
Notifications
You must be signed in to change notification settings - Fork 0
/
SaleAndRent.java
43 lines (34 loc) · 1.1 KB
/
SaleAndRent.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package realestateapp;
import java.util.Scanner;
public class SaleAndRent extends RealEstate{
transient Scanner in = new Scanner(System.in);
// new ad
public void newAd() {
super.newAd();
System.out.println("Enter The Type Of The Ad:(Sale, Rent)");
String answer = in.nextLine();
if (answer.equalsIgnoreCase("Sale")) {
System.out.println("Enter The Price Of This Property, Please: ");
this.price = in.nextFloat();
System.out.println("Enter The Number Of The Rooms For This Estate: ");
this.room = in.nextInt();
this.adType = "Sale";
} else if (answer.equalsIgnoreCase("Rent")) {
setMortgage();
setRent();
System.out.println("Enter The Number Of The Rooms For This Estate: ");
this.room = in.nextInt();
this.adType = "Rent";
}
}
// setter for rent
public void setRent() {
System.out.println("Enter The Amount Of Rent For This Property, Please: ");
this.rent = in.nextFloat();
}
// setter for mortgage
public void setMortgage() {
System.out.println("Enter The Amount Of Mortgage: ");
this.mortgage = in.nextFloat();
}
}