-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
72 lines (52 loc) · 2.25 KB
/
Copy pathMain.java
File metadata and controls
72 lines (52 loc) · 2.25 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
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
Car[] cars = new Car[] {
new Car("Nissan", 5000, 2020, "red", new String[] {"tires", "keys"}),
new Car("Dodge", 8500, 2019, "blue", new String[] {"tires", "keys"}),
new Car("Nissan", 5000, 2017, "yellow", new String[] {"tires", "filter"}),
new Car("Honda", 7000, 2019, "orange", new String[] {"tires", "filter"}),
new Car("Mercedes", 12000, 2015, "jet black", new String[] {"tires", "filter", "transmission"})
};
Dealership dealership = new Dealership(cars);
/** Task 1 – Add user input.
*
* System.out.println("\n ****** JAVA DEALERSHIP! ****** \n");
* System.out.print("Welcome! Enter the type of car you're looking for: ");
* //pick up make
* System.out.print("Enter your budget: ");
* //pick up budget
*
*/
System.out.println("\n ****** JAVA DEALERSHIP! ****** \n");
System.out.print("Welcome! Enter the type of car you're looking for: ");
String searchMake = scan.nextLine();
System.out.print("Enter your budget: ");
int searchPrice = scan.nextInt();
scan.nextLine();
int searchResult = dealership.search(searchMake, searchPrice);
switch(searchResult) {
case 404:
System.out.println("Feel free to browse through our collection of cars.\n");
System.out.println(dealership);
break;
default:
String decision = scan.nextLine();
if(decision.equalsIgnoreCase("yes")) {
dealership.sell(searchResult);
}
}
// Task 3 - Call the search action.
/* Task 4: case 404
println : Feel free to browse through our collection of cars.\n
print the dealership.
*/
/* Task 5 – Selling the car.
If it finds a car, pick up the user's decision.
If the decision is yes, sell them a car.
*/
// Task 6 – Ignore letter cases.
scan.close();
}
}