online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
/****************************************************************************** Online Java Compiler. Code, Compile, Run and Debug java program online. Write your code in this editor and press "Run" button to execute it. *******************************************************************************/ import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan= new Scanner(System.in); Motel[] motel = new Motel[4]; for(int i=0; i<motel.length; i++){ int MotelId = scan.nextInt(); scan.nextLine(); String MotelName = scan.nextLine(); String DateOfBooking = scan.nextLine(); int noOfRoomBooking = scan.nextInt(); scan.nextLine(); String cabFacility = scan.nextLine(); double totalBill = scan.nextDouble(); scan.nextLine(); motel[i] = new Motel(MotelId,MotelName,DateOfBooking,noOfRoomBooking,cabFacility,totalBill); } String key = scan.nextLine(); int result = totalNoOfRoomBooked(motel,key); if(result > 0){ System.out.println(result); } else{ System.out.println("No room available"); } } public static int totalNoOfRoomBooked(Motel[] motel, String key){ int count=0; for(int i=0; i<motel.length; i++){ if((motel[i].getcabFacility().equalsIgnoreCase(key))&& (motel[i].getnoOfRoomBooking() > 5)) { count = count + motel[i].getnoOfRoomBooking(); } } return count; } } class Motel { private int MotelId; private String MotelName; private String DateOfBooking; private int noOfRoomBooking; private String cabFacility; private double totalBill; Motel (int MotelId,String MotelName ,String DateOfBooking ,int noOfRoomBooking,String cabFacility, double totalBill){ this.MotelId = MotelId; this.MotelName = MotelName; this.DateOfBooking = DateOfBooking; this.noOfRoomBooking = noOfRoomBooking; this.cabFacility = cabFacility; this.totalBill = totalBill; } public void setMotelId(int MotelId){ this.MotelId = MotelId; } public int getMotelId(){ return this.MotelId; } public void setMotelName(String MotelName){ this.MotelId = MotelId; } public String getMotelName(){ return this.MotelName; } public void setDateOfBooking(String DateOfBooking){ this.DateOfBooking = DateOfBooking; } public String getDateOfBooking(){ return this.DateOfBooking; } public void setnoOfRoomBooking(int noOfRoomBooking){ this.noOfRoomBooking = noOfRoomBooking; } public int getnoOfRoomBooking(){ return this.noOfRoomBooking; } public void setcabFacility(String cabFacility){ this.cabFacility = cabFacility; } public String getcabFacility(){ return this.cabFacility; } public void settotalBill(double totalBill){ this.totalBill = totalBill; } public double gettotalBill(){ return this.totalBill; } }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue