-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCarMain.java
More file actions
43 lines (38 loc) · 1.43 KB
/
CarMain.java
File metadata and controls
43 lines (38 loc) · 1.43 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
import controller.CarController;
import java.util.Scanner;
public class CarMain {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("AUTO FACTORY");
boolean flag = true;
//utwprzenie obiektu kontroler
CarController cc = new CarController();
while (flag) {
System.out.println(" 1.Zamówienie auta\n 2.Lista zamowień\n 0.Wyjście");
int decision = sc.nextInt();
sc.nextLine();
switch (decision) {
case 1:
System.out.println("Podaj markę");
String brand = sc.nextLine();
System.out.println("Podaj model");
String model = sc.nextLine();
System.out.println("Podaj cene");
double price = sc.nextDouble();
System.out.println("Podaj rok");
int year = sc.nextInt();
cc.purchaseCar(brand, model, price, year);
break;
case 2:
System.out.println("Ilość wprowadzonych samochodów: " + CarController.getIndex());
cc.getCars();
break;
case 0:
flag = false;
break;
default:
System.out.println("Błędny wybór");
}
}
}
}