diff --git a/Exercises/src/day_2/Day2_2.java b/Exercises/src/day_2/Day2_2.java new file mode 100644 index 0000000..04e4c3e --- /dev/null +++ b/Exercises/src/day_2/Day2_2.java @@ -0,0 +1,38 @@ +package day_2; + +import java.util.Scanner; + +public class Day2_2 { + + public static void main(String[] args) { + String[] messages = { "いまなにしてる", "何も入力されていません", "投稿文が長すぎます", "↓↓↓↓↓↓ 投稿されました ↓↓↓↓↓↓" }; + + Scanner scan = new Scanner(System.in); + String str = ""; + int maxLength = 140; + + while (true) { + System.out.println(messages[0]); + str = scan.nextLine().replace(" ", "").replace(" ", ""); + + // 早期リターン (Early Return / Guard Clause) ကို အသုံးပြု၍ ချက်ချင်းစစ်ဆေးခြင်း + if (str.isEmpty()) { + System.out.println(messages[1]); + continue; + } + + if (str.length() > maxLength) { + System.out.println(messages[2]); + continue; + } + + break; + } + + System.out.println(); + System.out.println(messages[3]); + System.out.println(str); + + scan.close(); + } +} diff --git a/MyProject/src/doc/HotelReceptionProject1.drawio.pdf b/MyProject/src/doc/HotelReceptionProject1.drawio.pdf new file mode 100644 index 0000000..ccf25d3 Binary files /dev/null and b/MyProject/src/doc/HotelReceptionProject1.drawio.pdf differ diff --git a/MyProject/src/hotelReservation/DeluxeRoom.java b/MyProject/src/hotelReservation/DeluxeRoom.java new file mode 100644 index 0000000..1bb6ebd --- /dev/null +++ b/MyProject/src/hotelReservation/DeluxeRoom.java @@ -0,0 +1,19 @@ +package hotelReservation; + +public class DeluxeRoom extends Room { + private int serviceFees; + + public DeluxeRoom (int roomNumber,int serviceFees) { + super (roomNumber,6990); //make service fees for Deluxe romm + this.serviceFees = serviceFees; + } + @Override + public double calculateTotal (int nights) { + return (pricePerNight*nights)+serviceFees; + } + @Override + public String getRoomInfo() { + return "Delixe Room Number" +roomNumber+ "includeing Service Fees"; + } + +} diff --git a/MyProject/src/hotelReservation/Reception.java b/MyProject/src/hotelReservation/Reception.java new file mode 100644 index 0000000..0e335ee --- /dev/null +++ b/MyProject/src/hotelReservation/Reception.java @@ -0,0 +1,16 @@ +package hotelReservation; + +import javax.swing.JFrame; + +public class Reception { + + public static void main(String[] args) { + // To Male Frame In GUI + JFrame frame = new JFrame("Booking Here"); + frame.setSize(500, 600); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.setLayout(null); + frame.setVisible(true); + } + +} diff --git a/MyProject/src/hotelReservation/Reservation.java b/MyProject/src/hotelReservation/Reservation.java new file mode 100644 index 0000000..09f0ed3 --- /dev/null +++ b/MyProject/src/hotelReservation/Reservation.java @@ -0,0 +1,29 @@ +package hotelReservation; + +public class Reservation { + private String guestName; + private Room room; + private String checkInDay; + private int nights; + + public Reservation(String gustName, Room room, String checkInDay, int nights) { + this.guestName = gustName; + this.room = room; + this.checkInDay = checkInDay; + this.nights = nights; + } + + // Detail of Booking information (so se should be make new object {totalCost} + // from room calculate **from override + public String getReservationDetails() { + double totalCost = room.calculateTotal(nights); + return "===== BOOKIN DETAILS =====\n" + + "GUEST NAME :" + guestName + "\n" + + "CHECKIN DATE :" + checkInDay + "\n" + + room.getRoomInfo() + "\n" + + "STAY:" + nights + " night\n" + + "TOTAL AMMOUNT :" + totalCost + "Yen\n"; + + } + +} diff --git a/MyProject/src/hotelReservation/Room.java b/MyProject/src/hotelReservation/Room.java new file mode 100644 index 0000000..351ddac --- /dev/null +++ b/MyProject/src/hotelReservation/Room.java @@ -0,0 +1,20 @@ +package hotelReservation; + +public class Room { + protected int roomNumber; + protected int pricePerNight; + // Constructor + public Room (int roomNumber,int pricePreNight) { + this.roomNumber= roomNumber; + this.pricePerNight = pricePreNight; + } + //1 ammount for every room + public double calculateTotal (int nights) { //this method will be override in otherclass + return pricePerNight*nights; + } + //Show Info for firt time + public String getRoomInfo() { //this method will be override in otherclass + return "Room Number"+ roomNumber+"Per Night"+pricePerNight; + + } +} diff --git a/MyProject/src/hotelReservation/StandardRoom.java b/MyProject/src/hotelReservation/StandardRoom.java new file mode 100644 index 0000000..d7b386c --- /dev/null +++ b/MyProject/src/hotelReservation/StandardRoom.java @@ -0,0 +1,9 @@ +package hotelReservation; + +public class StandardRoom extends Room { + public StandardRoom(int roomNumber) { + super(roomNumber,1450); //make stsndar Room price for per nigh + + } + +}