-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProject.java
More file actions
119 lines (113 loc) · 5.05 KB
/
Project.java
File metadata and controls
119 lines (113 loc) · 5.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
package project.pkg1;
import java.util.*;
/*
* @author Adriel
*/
public class Project1 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int count = 0;
String answer = "";
int validation = 0;
int validation_2 = 0;
boolean decision = true;
double [][] seat_arrange = new double [][]{
{10, 10, 10, 10, 10, 10, 10, 10, 10, 10},
{10, 10, 10, 10, 10, 10, 10, 10, 10, 10},
{10, 10, 10, 10, 10, 10, 10, 10, 10, 10},
{10, 10, 20, 20, 20, 20, 20, 20, 10, 10},
{10, 10, 20, 20, 20, 20, 20, 20, 10, 10},
{10, 10, 20, 20, 20, 20, 20, 20, 10, 10},
{20, 20, 30, 30, 40, 40, 30, 30, 20, 20},
{20, 30, 30, 40, 50, 50, 40, 30, 30, 20},
{30, 40, 50, 50, 50, 50, 50, 50, 40, 30},
};
while(count < 90)
{
System.out.println("\t\tWelcome to Muvico");
System.out.println("---------------------------------------------------------------");
System.out.println("");
do
{
do
{
System.out.println("if u want a resevation chose '1' to seach by seats.\n"
+ "Enter '2' to seach by price");
int choise = input.nextInt();
switch(choise)
{
case 1:
System.out.println("Enter first the info");
System.out.print("Row: ");
int row = input.nextInt()-1;
System.out.print("Column: ");
int column = input.nextInt()- 1;
if(seat_arrange[row][column] == 0)
{
System.out.println("Seat sold");
count++;
}
if(seat_arrange[row][column] != 0)
{
System.out.println("Your seat have been reserved");
seat_arrange[row][column] = 0;
}
break;
case 2:
boolean found = false;
System.out.println("enter the price u r looking 4 ");
System.out.print("price: ");
double price = input.nextDouble();
for(int i = 0; i < seat_arrange.length;i++)
{
for(int j = 0; j < seat_arrange[i].length;j++)
{
if(seat_arrange[i][j] == price)
{
found = true;
System.out.println("the abalible seat with respect to price is at: "
+ "row:"+(i+1) +" and "+ "column:"+(j+1));
seat_arrange[i][j] = 0;
count++;
break;
}
}
if(found)
{
break;
}
}
if(!found)
{
System.out.println("Seat not found");
}
break;
default:
System.out.println("Please only choose '1' or '2'");
validation_2 = 1;
break;
}
}while(validation_2 == 1);
do
{
System.out.println("Do you want another ticket?");
answer = input.next();
if(answer.equals("No") || answer.equals("no"))
{
validation = 1;
break;
}
if(answer.equals("Yes") || answer.equals("yes"))
{
validation = 0;
}
else
{
System.out.println("please put yes or no.");
decision = false;
}
}while(decision == false);
}while(validation == 0);
}
}
}