Durban-World Hotel needs an application that will help them with the booking. They need a GUI...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Durban-World Hotel needs an application that will help them with the booking. They need a GUI application that will generate a total price for a booking based on the type of a room, number of people and number of days they will be staying. Room Type Single Double Grand Deluxe Room Code S D G Price Per Person 250 380 495 For a stay of 14 days or more a discount of 15% will be offered; for a stay of 10 days or more 10% discount will be offered; for a stay of 7 days 7.5% discount will be offered. 1 Note the following is provided in the folder for you: ⚫ Various exception classes are provided below, which must be raised or handled where necessary. Booking Class is given below with attributes and methods ⚫ BookingDA class, will be given as template, you will need to type missing code where red number is labelled. Read code properly in order to know which missing code you need to type. template classes for GUI Screens-will be given as template, you will need to type missing code where red number is labelled. Read code properly in order to know which missing code you need to type. • Note: there will be a text area at the bottom of each question where you will need to type your answer. Various Exception Classes public class DataStorageException extends IOException { public DataStorageException() { } public DataStorageException(String msg) { super(msg);} public class DuplicateException extends Exception { public DuplicateException() { } public DuplicateException(String msg) { super(msg); } public class NotFoundException extends Exception { public NotFoundException() { } public NotFoundException(String msg){ super(msg); } Booking Class public class Booking { private String name, title; private char roomsize; private int ndays,npeoplesharing; public Booking(){ name= title=""; roomsize=''; ndays=npeoplesharing=0; } public Booking(String title, String name, char roomsize, int ndays,int npeoplesharing){ } setName(name); setTitle(title); setRoomSize(roomsize); setNDays(ndays); set NPeopleSharing(npeoplesharing); public void setName(String name){ if(name.length() < 3){ throw new IllegalArgumentException("Invalid name"); }else{ this.name name; }} 2 public void setTitle(String title){ if(title.length() < 2) { throw new IllegalArgumentException("Invalid title"); }else{ this.title = title; } } public void setNDays(int ndays){ if(ndays < 0){ throw new IllegalArgumentException("Invalid number of days"); }else{ } this.ndays = ndays; } public void setNPeopleSharing(int npeoplesharing) { if(ndays < 0){ } } throw new IllegalArgumentException("Invalid number of people"); }else{ this.npeoplesharing = npeoplesharing; public void setRoomSize(char roomsize){ } String strSize = String.valueOf(roomsize).toUpperCase(); if(strSize.equals("S") || strSize.equals("D")|| strSize.equals("G")){ this.roomsize roomsize; }else{ } throw new IllegalArgumentException("Invalid room size"); public String getTitle(){return title;} public String getName(){return name;} public char getRoomSize(){return roomsize; } public int getNdays(){ return ndays; } public int getNpeopleSharing(){ return npeoplesharing; } //end provided class members Implement a three-tier design with Problem Domain (PD), Data Access (DA) and GUI classes. Initial classes are provided as specified above. You will need to modify classes as required. DA - BookingDA class: - Methods must raise necessary exceptions • Initialise the data storage-read booking records from file and store it to an array list - called arBook and terminate the data storage - must save arraylist to file. The files must be read and saved using object streams in a file called - booking.dat ⚫ addNewBooking () - it must add a new booking record to arraylist, make sure there are no duplicate records, use client name to check for duplicates. ⚫ SearchBooking method, must find and return client booking record based on the client name. ⚫ getAllBookings method, must return all bookings stored in an arraylist. 3 . Create void method count BookingPerRoomType(), it takes no parameters and processes the arBook array list, validates for each room type and count the number of bookings for that room type and display counted number of booking for each room type in the message dialog. PD-Booking class: - ⚫ invoke (call) all DA methods accordingly ⚫ getStdPrice() method that receives no parameters, it must validate for the room type code you are booking for and calculate and return the standard price base on the number of days and number of people sharing. Check table for room type price. ⚫ calc Discount Amt() method that receives no parameters, calculates and return the discount amount the client will save based on the number of days staying. Check allocated discount percentages for days staying in the problem statement. ⚫ calcTotalPricePayable() method that receives no parameters, calculates and return total price to be paid after deducting the discount amount. toString() method to display the booking details: ie title, name room type code, number of days, number of people, standard price, discount amount, total price payable. Make sure it has proper tabs. All amounts must be formatted to currencies. Note: you can use NumberFormat class to format Amount values to currencies. Create Java class called: AddBooking that inherits from JFrame Your Screen (Frame) must be created as shown in the screen shot below: It must have a fixed size and not resizable. All components must be added to panel. Combobox component must be populated with Mr, Ms, Prof and Dr titles All components must be aligned correctly- no floating components CLIENT BOOKING FORM Title: Mr Name: Room Size: Single Double Grand Deluxe No of People: No of Days: Add Booking Clear Close On Button Add Booking It must get all inputs from the user and call Booking class and call addNewBooking() from PD class to add all Booking data to arraylist. On Button Clear It must restore form to its original state and set focus to title combobox. 5 On Button Close It must close only this screen, not the whole application Create Java class called: View AllBookings that inherits from JFrame Your Screen (Frame) must be created as shown in the screen shot below: It must have textarea component, placed at the center of the border. TextArea must not be editable. This screen must display all bookings data from arraylist, with correct headings. VIEW ALL CLIENT BOOKINGS SCREEN-BY MS MNGOMA (21000000) Client Name Ms Mngoma Mr Mokoena Room D S NDays 7 NPeople 10 4 Prof Mkwanazi G 4 3 StaPrice R 15,960.00 R 10,000.00 R 5,940.00 DiscAmt R 1,197.00 R 1,000.00 R 0.00 Dr Damiela S 10 7 R 17,500.00 Ms Loubser D 12 5 R 22,800.00 R 1,750.00 R 2,280.00 Tot Payable R 14,763.00 R 9,000.00 R 5,940.00 R 15,750,00 R 20,520.00 Create Java main class called: MenuScreen that inherits from JFrame Your Screen (Frame) must be created as shown in the screen shot below: MAIN MENU - BY MS MNGOMA - ☐ X File Bookings Search Booking by Client Name Count No of Booking for Each Room Size Exit MAIN MENU - BY MS MNGOMA File Bookings Add Booking View All Bookings On the default constructor of this class: • Handle exception accordingly ⚫ Call initialise method of PD class On Add Booking menu item Open the Add Booking screen, with screen name, your name and your student no as title of the screen ⚫ It must have a fixed size and not resizable. On View All Bookings menu item Open the View All Bookings screen, with screen name, your name and your student no as title of the screen It must have a fixed size and not resizable. ⚫ it must call getAllBookings () method to display all bookings from arraylist On Search booking by Client Name menu item It must use input dialog to get the name of the client to be searched. 5 It must call the searchBooking() method accordingly and display return record in a message box. MAIN MENU - BY MS MNGOMA MAIN MENU - BY MS MNGOMA File Bookings Found Client Booking: Ms Mngoma D 7 6 R 15,960.00 R 1,197.00 R 14,763.00 OK File Bookings Error Message! ☑Moyo dont exist. OK On Count No of Booking for Each Room Size menu item ⚫ It must call count Booking PerRoomType method accordingly. MAIN MENU - BY MS MNGOMA File Bookings Counted Room Types Single Room Count: 2 Deluxe Room Count: 2 Grand Deluxe Room Count: 1 OK On Exit menu item It must Handle exception accordingly ⚫ It must confirm if user wants to exit - it must Call terminate method of PD class and exit application on Yes. In the main() method ⚫It must open the Menu Screen with screen name, your name and your student no as title of the screen ⚫ The Screen must Exit on close Durban-World Hotel needs an application that will help them with the booking. They need a GUI application that will generate a total price for a booking based on the type of a room, number of people and number of days they will be staying. Room Type Single Double Grand Deluxe Room Code S D G Price Per Person 250 380 495 For a stay of 14 days or more a discount of 15% will be offered; for a stay of 10 days or more 10% discount will be offered; for a stay of 7 days 7.5% discount will be offered. 1 Note the following is provided in the folder for you: ⚫ Various exception classes are provided below, which must be raised or handled where necessary. Booking Class is given below with attributes and methods ⚫ BookingDA class, will be given as template, you will need to type missing code where red number is labelled. Read code properly in order to know which missing code you need to type. template classes for GUI Screens-will be given as template, you will need to type missing code where red number is labelled. Read code properly in order to know which missing code you need to type. • Note: there will be a text area at the bottom of each question where you will need to type your answer. Various Exception Classes public class DataStorageException extends IOException { public DataStorageException() { } public DataStorageException(String msg) { super(msg);} public class DuplicateException extends Exception { public DuplicateException() { } public DuplicateException(String msg) { super(msg); } public class NotFoundException extends Exception { public NotFoundException() { } public NotFoundException(String msg){ super(msg); } Booking Class public class Booking { private String name, title; private char roomsize; private int ndays,npeoplesharing; public Booking(){ name= title=""; roomsize=''; ndays=npeoplesharing=0; } public Booking(String title, String name, char roomsize, int ndays,int npeoplesharing){ } setName(name); setTitle(title); setRoomSize(roomsize); setNDays(ndays); set NPeopleSharing(npeoplesharing); public void setName(String name){ if(name.length() < 3){ throw new IllegalArgumentException("Invalid name"); }else{ this.name name; }} 2 public void setTitle(String title){ if(title.length() < 2) { throw new IllegalArgumentException("Invalid title"); }else{ this.title = title; } } public void setNDays(int ndays){ if(ndays < 0){ throw new IllegalArgumentException("Invalid number of days"); }else{ } this.ndays = ndays; } public void setNPeopleSharing(int npeoplesharing) { if(ndays < 0){ } } throw new IllegalArgumentException("Invalid number of people"); }else{ this.npeoplesharing = npeoplesharing; public void setRoomSize(char roomsize){ } String strSize = String.valueOf(roomsize).toUpperCase(); if(strSize.equals("S") || strSize.equals("D")|| strSize.equals("G")){ this.roomsize roomsize; }else{ } throw new IllegalArgumentException("Invalid room size"); public String getTitle(){return title;} public String getName(){return name;} public char getRoomSize(){return roomsize; } public int getNdays(){ return ndays; } public int getNpeopleSharing(){ return npeoplesharing; } //end provided class members Implement a three-tier design with Problem Domain (PD), Data Access (DA) and GUI classes. Initial classes are provided as specified above. You will need to modify classes as required. DA - BookingDA class: - Methods must raise necessary exceptions • Initialise the data storage-read booking records from file and store it to an array list - called arBook and terminate the data storage - must save arraylist to file. The files must be read and saved using object streams in a file called - booking.dat ⚫ addNewBooking () - it must add a new booking record to arraylist, make sure there are no duplicate records, use client name to check for duplicates. ⚫ SearchBooking method, must find and return client booking record based on the client name. ⚫ getAllBookings method, must return all bookings stored in an arraylist. 3 . Create void method count BookingPerRoomType(), it takes no parameters and processes the arBook array list, validates for each room type and count the number of bookings for that room type and display counted number of booking for each room type in the message dialog. PD-Booking class: - ⚫ invoke (call) all DA methods accordingly ⚫ getStdPrice() method that receives no parameters, it must validate for the room type code you are booking for and calculate and return the standard price base on the number of days and number of people sharing. Check table for room type price. ⚫ calc Discount Amt() method that receives no parameters, calculates and return the discount amount the client will save based on the number of days staying. Check allocated discount percentages for days staying in the problem statement. ⚫ calcTotalPricePayable() method that receives no parameters, calculates and return total price to be paid after deducting the discount amount. toString() method to display the booking details: ie title, name room type code, number of days, number of people, standard price, discount amount, total price payable. Make sure it has proper tabs. All amounts must be formatted to currencies. Note: you can use NumberFormat class to format Amount values to currencies. Create Java class called: AddBooking that inherits from JFrame Your Screen (Frame) must be created as shown in the screen shot below: It must have a fixed size and not resizable. All components must be added to panel. Combobox component must be populated with Mr, Ms, Prof and Dr titles All components must be aligned correctly- no floating components CLIENT BOOKING FORM Title: Mr Name: Room Size: Single Double Grand Deluxe No of People: No of Days: Add Booking Clear Close On Button Add Booking It must get all inputs from the user and call Booking class and call addNewBooking() from PD class to add all Booking data to arraylist. On Button Clear It must restore form to its original state and set focus to title combobox. 5 On Button Close It must close only this screen, not the whole application Create Java class called: View AllBookings that inherits from JFrame Your Screen (Frame) must be created as shown in the screen shot below: It must have textarea component, placed at the center of the border. TextArea must not be editable. This screen must display all bookings data from arraylist, with correct headings. VIEW ALL CLIENT BOOKINGS SCREEN-BY MS MNGOMA (21000000) Client Name Ms Mngoma Mr Mokoena Room D S NDays 7 NPeople 10 4 Prof Mkwanazi G 4 3 StaPrice R 15,960.00 R 10,000.00 R 5,940.00 DiscAmt R 1,197.00 R 1,000.00 R 0.00 Dr Damiela S 10 7 R 17,500.00 Ms Loubser D 12 5 R 22,800.00 R 1,750.00 R 2,280.00 Tot Payable R 14,763.00 R 9,000.00 R 5,940.00 R 15,750,00 R 20,520.00 Create Java main class called: MenuScreen that inherits from JFrame Your Screen (Frame) must be created as shown in the screen shot below: MAIN MENU - BY MS MNGOMA - ☐ X File Bookings Search Booking by Client Name Count No of Booking for Each Room Size Exit MAIN MENU - BY MS MNGOMA File Bookings Add Booking View All Bookings On the default constructor of this class: • Handle exception accordingly ⚫ Call initialise method of PD class On Add Booking menu item Open the Add Booking screen, with screen name, your name and your student no as title of the screen ⚫ It must have a fixed size and not resizable. On View All Bookings menu item Open the View All Bookings screen, with screen name, your name and your student no as title of the screen It must have a fixed size and not resizable. ⚫ it must call getAllBookings () method to display all bookings from arraylist On Search booking by Client Name menu item It must use input dialog to get the name of the client to be searched. 5 It must call the searchBooking() method accordingly and display return record in a message box. MAIN MENU - BY MS MNGOMA MAIN MENU - BY MS MNGOMA File Bookings Found Client Booking: Ms Mngoma D 7 6 R 15,960.00 R 1,197.00 R 14,763.00 OK File Bookings Error Message! ☑Moyo dont exist. OK On Count No of Booking for Each Room Size menu item ⚫ It must call count Booking PerRoomType method accordingly. MAIN MENU - BY MS MNGOMA File Bookings Counted Room Types Single Room Count: 2 Deluxe Room Count: 2 Grand Deluxe Room Count: 1 OK On Exit menu item It must Handle exception accordingly ⚫ It must confirm if user wants to exit - it must Call terminate method of PD class and exit application on Yes. In the main() method ⚫It must open the Menu Screen with screen name, your name and your student no as title of the screen ⚫ The Screen must Exit on close
Expert Answer:
Answer rating: 100% (QA)
Here is an example implementation of the provided problem statement using Java BookingDAjava import javaio import javautilArrayList public class BookingDA private ArrayList arBook private final String ... View the full answer
Related Book For
Introduction To Leadership Concepts And Practice
ISBN: 9781506330082
4th Edition
Authors: Peter G. Northouse
Posted Date:
Students also viewed these programming questions
-
Three ratios calculated for Puckerman, Cohen, and Chang Companies for 2010 and 2011 follow. Required: Explain which company appears to be the most liquid. (in millions) Current ratio Inventory...
-
Macron Corporation manufactures two productsLaptops and Tablets. The monthly production and sales of Laptops is 1,800 units, while 8,000 units of Tablets are produced and sold. The company has...
-
The adjusted trial balance for Sweet Home Catering, Inc., is presented below. Prepare the income statement and statement of retained earnings for Sweet Home Catering, Inc., for the month ended March...
-
On April 1, 2017, Taylor Corp. sold 12,000 of its $1,000 face value, 15-year, 11% bonds at 97. Interest payment dates are April 1 and October 1, and the company uses the straight-line method of bond...
-
Determine the lattice coefficients corresponding to the FIR filter with system function H(z) = A3(z) = 1 + 12/24z 1 + 5/8z 2 + 1/3z 3
-
An ideal gas is heated from \(25^{\circ} \mathrm{C}\) to \(145^{\circ} \mathrm{C}\). The mass of the gas is \(2 \mathrm{~kg}\). Determine: (i) specific heats, (ii) change in internal energy, (iii)...
-
Draw an ERD for the following situation. (State any assumptions you believe you have to make in order to develop a complete diagram.) Also, draw a data model for this situation using the tool you...
-
Two resultant forces 100kN and Q kN acting at a point at an angle 90 between them. If resultant force is 200kN, find value of Q. Also find angle made by resultant with 100kN force?
-
A firm is analyzing their pricing and operations for next year based on the following anticipated cost structure, the given level of production and sales, and their target operating income margin of...
-
What are the three main aspects that make an energy source sustainable?
-
A snowboarder on a slope starts from rest and reaches a speed of 2.1 m/s after 9.2 s. (a) What is the magnitude (in m/s) of the snowboarder's average acceleration? (b) m/s How far (in m) does the...
-
Characterize the nature of motivation, including its importance and focus Identify and describe the need theories on motivation. Identify and describe the behavior theories on motivation. Identify...
-
An investment of $1600 made in 2019 grew to $1800 in 2020. What is the real rate of return on this investment if the ratio of 2020 to 2019 price levels in the economy is 1.2?
-
An ordinary annuity pays 200 per month for 2 years, then 300 per month for the next year, and then 100 per month for the following two years. Find the present value of the annuity at a rate of 6%...
-
David McLelland's motivational theory identified three principal motivational needs which he said each of us possesses to varying degrees, and which characterise our...
-
Choose the correct option from the following, show calculaltions 1 dx x In x (a) In 2 (b) 1 (c) - 1 e4 (d) (e) none of these e2
-
What is the purpose of the journal wizard?
-
One of the most difficult challenges leaders face is to integrate their task and relationship behaviors. Do you see this as a challenge in your own leadership? How do you integrate task and...
-
As you reflect on your own leadership traits, do you think some of them are more you and authentic than others? Have you always been the kind of leader you are today, or have your traits changed over...
-
Purpose 1. To develop an understanding of your leadership strengths 2. To rank your strengths in selected areas of performance Directions 1. Please answer the statements below in terms of whether the...
-
A second-order dynamic system is modeled as \[9 \ddot{x}+6 \dot{x}+\frac{10}{9} x=14 \delta(t), \quad x(0)=0, \quad \dot{x}(0)=-\frac{1}{4}\] a. Find the response \(x(t)\) in closed form. b. Plot the...
-
Consider a first-order system with time constant \(\tau\) and zero initial condition. Find the system's unit-step response for \(\tau=\frac{1}{3}\) and \(\frac{2}{3}\), plot the two curves versus \(0...
-
a. Identify the damping type and find the free response. b. Plot the free response by using the initial command. \(\ddot{x}+3 \dot{x}+4 x=0, \quad x(0)=\frac{2}{5}, \quad \dot{x}(0)=0\)
Study smarter with the SolutionInn App