Question: CREATE THIS JAVA CODE IN YOUR OWN APPROACH BUT STILL IN JAVA LANGUAGE import java.util.Scanner; public class BusSeatsApp { public static void main(String[] args) {

CREATE THIS JAVA CODE IN YOUR OWN APPROACH BUT STILL IN JAVA LANGUAGE

import java.util.Scanner; public class BusSeatsApp { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String[][] bus = new String[10][4]; for(int row=0;row<10;row++){ for(int col=0;col<4;col++){ bus[row][col] = "*"; } } int choice = 999; while(choice>=0){ for(int row=0;row<11;row++){ for(int col=0;col<5;col++){ if(row==0){ if(col==0){ System.out.print("\t"); }else{ System.out.print("col "+(col)+"\t"); } } if(col==0){ if(row==0){ System.out.print(""); }else{ System.out.print("row "+(row)+"\t"); } } if(row!=0&&col!=0){ if(col==1){ System.out.print("|"+bus[row-1][col-1]+"\t"); }else{ System.out.print(bus[row-1][col-1]+"\t"); } } } System.out.println(""); } System.out.println("Enter row and column number to reserve separated by space (Enter a negative number to exit):"); choice = sc.nextInt(); if(choice>=0){ int i = choice; int j = sc.nextInt(); bus[i-1][j-1]="X"; } } }

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!