Skip to content

Commit 628e577

Browse files
committed
Constructors Basics added
1 parent 549b433 commit 628e577

2 files changed

Lines changed: 35 additions & 0 deletions

File tree

Basics/Constructors/MyMain.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
public class MyMain {
2+
public static void main(String[] args) {
3+
Recepitionist recep1= new Recepitionist();
4+
boolean status = recep1.checkRoomAvailability(3);
5+
double bill = recep1.generateBill();
6+
recep1.takeCustomerFeddback();
7+
}
8+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
public class Recepitionist {
2+
private int staffID;
3+
private String name;
4+
private String telephoneNumber;
5+
6+
// Default Constructor
7+
public Recepitionist() {
8+
this.staffID = 0;
9+
this.name = "abc";
10+
this. telephoneNumber = null;
11+
}
12+
13+
// Overloaded Constructor
14+
public Recepitionist(int pID, String pName, String pTelephoneNumber) {
15+
this.staffID = pID;
16+
this.name = pName;
17+
this.telephoneNumber = pTelephoneNumber;
18+
}
19+
20+
public Boolean checkRoomAvailability(int roomNumber){
21+
return true;
22+
}
23+
public double generateBill(){
24+
return 0;
25+
}
26+
public void takeCustomerFeddback() { }
27+
}

0 commit comments

Comments
 (0)