JAVA问题(英文的)Write a program that assigns seats on an airplane.Assume the airplane has 20 seats in the first class (5 rows of 4 seats each,separated by an aisle) and 90 seats in economy class (15 rows of 6 seats each,separated by an aisle).Yo
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/28 03:53:08
JAVA问题(英文的)Write a program that assigns seats on an airplane.Assume the airplane has 20 seats in the first class (5 rows of 4 seats each,separated by an aisle) and 90 seats in economy class (15 rows of 6 seats each,separated by an aisle).Yo
JAVA问题(英文的)
Write a program that assigns seats on an airplane.Assume the airplane has 20 seats in the first class (5 rows of 4 seats each,separated by an aisle) and 90 seats in economy class (15 rows of 6 seats each,separated by an aisle).Your program should take three commands:add passengers,show seating,and quit.When passengers are added,ask for the class (first or economy),the number of passengers traveling together (1 or 2 in the first class; 1 to 3 in economy),and the seating preference (aisle or window in the first class; aisle,center,or window in economy).Then try to find a match and assign the seats.If no match exists,print a message stating as such.Your solution should include a class Airplane that is not coupled with the Scanner or Printstream classes.
Your main class should be called AirplaneSeatingSystem.
/**
This program implements an airplane seating system.
*/
public class AirplaneSeatingSystem
{
public static void main(String[] args)
{
AirplaneMenu menu = new AirplaneMenu();
menu.run();
}
}
Here is a sample program run.(Red items are possible user inputs.)
A)dd S)how Q)uit
A
F)irst E)conomy
F
Passengers?(1-2)
1
A)isle W)indow
A
A)dd S)how Q)uit
A
F)irst E)conomy
E
Passengers?(1-3)
2
A)isle C)enter W)indow
W
A)dd S)how Q)uit
A
F)irst E)conomy
E
Passengers?(1-3)
3
A)dd S)how Q)uit
A
F)irst E)conomy
E
Passengers?(1-3)
3
A)dd S)how Q)uit
S
1:.* ..
2:....
3:....
4:....
5:....
6:**.***
7:*** ...
8:......
9:......
10:......
11:......
12:......
13:......
14:......
15:......
16:......
17:......
18:......
19:......
20:......
A)dd S)how Q)uit
Q
JAVA问题(英文的)Write a program that assigns seats on an airplane.Assume the airplane has 20 seats in the first class (5 rows of 4 seats each,separated by an aisle) and 90 seats in economy class (15 rows of 6 seats each,separated by an aisle).Yo
不让用Scanner和Printstream
是不能导入其他包么