SOFTWARE ENGINEERING 2.
KIT/100/24: Charity Agosa Orindo.
Rental House Management System (15 Java Classes)
1. [Link]
public class Person {
protected String name;
protected String phone;
public Person(String name, String phone) {
[Link] = name;
[Link] = phone;
}
public void displayInfo() {
[Link]("Name: " + name + ", Phone: " + phone);
}
}
2. [Link]
public class Landlord extends Person {
public Landlord(String name, String phone) {
super(name, phone);
}
}
3. [Link]
public class Tenant extends Person {
private String tenantId;
public Tenant(String name, String phone, String tenantId) {
super(name, phone);
[Link] = tenantId;
}
public String getTenantId() {
return tenantId;
}
}
4. [Link]
public class House {
private String houseNumber;
private boolean occupied;
public House(String houseNumber) {
[Link] = houseNumber;
[Link] = false;
}
public boolean isOccupied() {
return occupied;
}
public void setOccupied(boolean status) {
[Link] = status;
}
public String getHouseNumber() {
return houseNumber;
}
}
5. [Link]
public class Apartment {
private String apartmentName;
public Apartment(String apartmentName) {
[Link] = apartmentName;
}
}
6. [Link]
public class Lease {
private Tenant tenant;
private House house;
private int durationMonths;
public Lease(Tenant tenant, House house, int durationMonths) {
[Link] = tenant;
[Link] = house;
[Link] = durationMonths;
[Link](true);
}
}
7. [Link]
public class Rent {
private double monthlyRent;
public Rent(double monthlyRent) {
[Link] = monthlyRent;
}
public double getMonthlyRent() {
return monthlyRent;
}
}
8. [Link]
public class Payment {
private double amount;
private String date;
public Payment(double amount, String date) {
[Link] = amount;
[Link] = date;
}
}
9. [Link]
public class Receipt {
public void printReceipt() {
[Link]("Payment received. Receipt generated.");
}
}
10. [Link]
public class Maintenance {
private String issue;
public Maintenance(String issue) {
[Link] = issue;
}
}
11. [Link]
public class Caretaker extends Person {
public Caretaker(String name, String phone) {
super(name, phone);
}
}
12. [Link]
public class Utility {
private String utilityType;
public Utility(String utilityType) {
[Link] = utilityType;
}
}
13. [Link]
public class Notice {
private String message;
public Notice(String message) {
[Link] = message;
}}
14. [Link]
public class Report {
public void generateReport() {
[Link]("Rental report generated.");
}}
15. [Link]
public class Main {
public static void main(String[] args) {
Landlord landlord = new Landlord("Mr. Otieno", "0712345678");
Tenant tenant = new Tenant("Kytes", "0798765432", "T001");
House house = new House("H12");
Lease lease = new Lease(tenant, house, 12);
Rent rent = new Rent(15000);
[Link]();
[Link]();
[Link]("House " + [Link]() +
" occupied: " + [Link]());
[Link]("Monthly Rent: KES " + [Link]());
}
}