import java.util.Scanner;
import java.util.Random;
class HotelBooking {
// (Same as before)
// Additional methods for Display Booking and Cancel Booking
public String getGuestName() {
return guestName;
}
public int getBookingID() {
return bookingID;
}
}
public class HotelBookingSystem {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
// (Same as before)
HotelBooking booking = new HotelBooking(guestName, selectedRoomType, roomPrice, requestedRooms, confirmationCode);
// (Same as before)
System.out.print("\nDo you want to display booking details? (Y/N): ");
char displayChoice = scanner.next().charAt(0);
if (displayChoice == 'Y' || displayChoice == 'y') {
displayBookingDetails(booking);
}
System.out.print("\nDo you want to cancel booking? (Y/N): ");
char cancelChoice = scanner.next().charAt(0);
if (cancelChoice == 'Y' || cancelChoice == 'y') {
cancelBooking(booking);
}
scanner.close();
}
// Additional methods for Display Booking and Cancel Booking
public static void displayBookingDetails(HotelBooking booking) {
System.out.println("\nBooking Details:");
System.out.println("Guest Name: " + booking.getGuestName());
System.out.println("Booking ID: " + booking.getBookingID());
System.out.println("Room Type: " + booking.roomType);
System.out.println("Number of Rooms: " + booking.numberOfRooms);
System.out.println("Total cost: RM" + booking.calculateTotalCost());
}
public static void cancelBooking(HotelBooking booking) {
System.out.println("\nBooking for " + booking.getGuestName() + " has been cancelled.");
}
}
add exist to the above
an do the flowchart with symbols and the pseudocode
Step by stepSolved in 4 steps with 1 images
- I need help fix this code described below in this image: import java.util.Scanner;import java.lang.Math; public class CarValue { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); Car myCar = new Car(); int userYear = scnr.nextInt(); int userPrice = scnr.nextInt(); int userCurrentYear = scnr.nextInt(); myCar.setModelYear(userYear); myCar.setPurchasePrice(userPrice); myCar.calcCurrentValue(userCurrentYear); myCar.printInfo(); }}arrow_forwardJava. Tally counter that increases and decreases. Refer to screenshot. Here is some code (class PoD): import java.util.*; public class PoD { public static void main (String [] args ) {Scanner in = new Scanner( System.in );PrettyTally tally = new PrettyTally(in.next());while (in.hasNext()){String nextTask = in.next();if (nextTask.equals("increment")){tally.increment();} else if (nextTask.equals("toString")){System.out.println(tally);}else if (nextTask.equals("decrement")){tally.decrement();}}in.close();}} Class PrettyTally: public class PrettyTally extends TallyCounter{ } Class TallyCounter import java.util.*; public class TallyCounter { protected int count=0;public TallyCounter(){this.count = 0;} public void increment(){this.count++;}public int get(){return this.count;}}arrow_forward} } import java.util.*; public class Problem$16 { public static void main(String[] args) { Scanner scan = new Scanner(System.in).use Locale (Locale.US); System.out.print("Enter the length of the side : "); double side = scan.nextDouble(); double area = ((3 * Math.pow(3, 0.5)) / 2) * Math.pow(side, 2); System.out.println("The area of the hexagon is " + area);arrow_forward
- Warmup Write a method called countSuit) that takes an array of Cards and a String suit as parameters and counts how many of the cards have the given suit. Complete the definition of the class Warmup and method definition countSuit shown below. public class Warmup { public static int countSuit(Card [] cards, String suit) { // fill in code here } } For example, if we ran the following code in the main method: Card[] cards = new Card[4]; cards [0] = new Card (4, "clubs"); cards [1] = new Card (12, "diamonds"); cards [2] = new Card (1, "hearts"); cards [3] new Card(10, "diamonds"); System.out.println(countSuit(cards, "diamonds")); the output printed would be 2.arrow_forwardimport java.util.Scanner;import java.util.ArrayList;import java.util.StringTokenizer; public class PlantArrayListExample { // TODO: Define a printArrayList method that prints an ArrayList of plant (or flower) objects public static void main(String[] args) { Scanner scnr = new Scanner(System.in); String input; // TODO: Declare an ArrayList called myGarden that can hold object of type plant // TODO: Declare variables - plantName, plantCost, flowerName, flowerCost, colorOfFlowers, isAnnual input = scnr.next(); while(!input.equals("-1")){ // TODO: Check if input is a plant or flower // Store as a plant object or flower object // Add to the ArrayList myGarden input = scnr.next(); } // TODO: Call the method printArrayList to print myGarden }}arrow_forwardimport java.util.*; public class Main0 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int totalEmployee = 10; String [] fname = new String[totalEmployee]; String [] mname = new String[totalEmployee]; String [] lname = new String[totalEmployee]; int [] idNum = new int[totalEmployee]; // Hours Worked Must be Between 0 and 60 Hours int [] workHour = new int[totalEmployee]; // Rate per Hour Must be Between $15.00 and $35.00 int [] ratePerHour = new int[totalEmployee]; // add Data in the array for (int i=0; i<totalEmployee; i++){ // First Name Input System.out.println("Enter First Name"); fname[i] = sc.next(); // Middle Name Input System.out.println("Enter Middle Name"); mname[i] = sc.next(); // Last Name Input System.out.println("Enter Last…arrow_forward
- Please write in Java import java.util.Scanner; public class ConcertPromoter { public static void main(String[] args) { Scanner key = new Scanner(System.in); Concert concert = new Concert(); System.out.println("Welcome to the Concert Promotion tool!"); String input = ""; while(input.equalsIgnoreCase("quit")!= true) { System.out.println("Currently the concert featuring the band: "+concert.getBandName()); System.out.println("Has sold "+concert.getNumTicketsSoldByPhone()+" tickets by phone"); System.out.println("Has sold "+concert.getNumTicketsSoldAtVenue()+" tickets at the venue"); System.out.println("And has grossed $"+concert.totalSales()); System.out.println("What would you like to do?\n" + "Enter 1: To change name\n" + "Enter 2: To change ticket by phone price\n" + "Enter 3: To change ticket at venue price\n" + "Enter 4: To add tickets by phone\n" + "Enter 5: To add tickets at the venue\n" + "Enter…arrow_forward1 import java.util.Scanner; 3 public class TriangleArea { INM&567 000 2 4 8 9 10 11 12 13 14 15 4567890 16 17 18 19 20 21 } public static void main(String[] args) { Scanner scnr = new Scanner(System.in); } Current file: TriangleArea.java = Triangle triangle1 new Triangle(); Triangle triangle2 = new Triangle(); // TODO: Read and set base and height for triangle1 (use setBase() and setHeight()) // TODO: Read and set base and height for triangle2 (use setBase() and setHeight()) System.out.println("Triangle with smaller area:"); // TODO: Determine smaller triangle (use getArea()) // and output smaller triangle's info (use printInfo())arrow_forwardHow do I remove the space at the end of the result? Code: import java.util.Scanner; public class FinalExamAnswers{ public static void main(String [] args) { manipulateString(); //calls function } //your code here public static void manipulateString() { Scanner sc=new Scanner(System.in); //create Scanner instance System.out.println("Enter a sentence"); String sentence=sc.nextLine(); //input a sentence String[] words=sentence.split(" "); //split the sentence at space and store it in array for(int i=0;i<words.length;i++) //i from 0 to last index { if(i%2==0) //if even index words[i]=words[i].toUpperCase(); //converted to upper case else //if odd index words[i]=words[i].toLowerCase(); //converted to lower case } for(int i=words.length-1;i>=0;i--) //i from last index to 0 {…arrow_forward
- JAVA CODE: check outputarrow_forwardAssign is Teenager with true if kidAge is 13 to 19 inclusive. Otherwise, assign is Teenager with false. 439894.2564214.qx3zqy7 1 import java.util.Scanner; □NM nor 2 3 public class TeenagerDetector { 4 5 6 7 8 9 10 11 12 13 14 15 16 17 public static void main (String [] args) { Scanner scnr = new Scanner(System.in); boolean isTeenager; int kidAge; kidAge scnr.nextInt(); * Your solution goes here if (isTeenager) { System.out.println("Teen"); } else { System.out.println("Not teen");arrow_forwardI have the following code: import java.util.*; import java.io.*; public class GradeBook { publicstaticvoidmain(String[] args)throwsIOException{ // TODO Auto-generated method stub File infile =newFile("students.dat"); Scanner in =newScanner(infile); while(in.hasNext()){ // Read information form file and create a student object and print String name = in.nextLine(); Student student =newStudent(name, in.nextLine()); for(int i =1; i <=4;++i){ student.setQuiz(i, in.nextInt()); } student.setMidtrmExm(in.nextInt()); student.setFinalExm(in.nextInt()); in.nextLine(); // Calculate grade and letter grade; double overallQuizScore=0.0,score=0.0; for(int i=1;i<=student.NUM_QUIZZES;i++) { overallQuizScore+=(student.getQuiz(i)/student.QUIZ_MAX_POINTS)*100; } overallQuizScore = (overallQuizScore/4)*0.30; score =…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education