-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCarsPQ_Inter.java
105 lines (93 loc) · 3.1 KB
/
CarsPQ_Inter.java
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
/**
* CarsPQ specification interface for CS1501 Project 3
* @author Dr. Farnan
*/
package cs1501_p3;
import java.util.NoSuchElementException;
interface CarsPQ_Inter {
/**
* Add a new Car to the data structure
* Should throw an `IllegalStateException` if there is already car with the
* same VIN in the datastructure.
*
* @param c Car to be added to the data structure
*/
public void add(Car c) throws IllegalStateException;
/**
* Retrieve a new Car from the data structure
* Should throw a `NoSuchElementException` if there is no car with the
* specified VIN in the datastructure.
*
* @param vin VIN number of the car to be updated
*/
public Car get(String vin) throws NoSuchElementException;
/**
* Update the price attribute of a given car
* Should throw a `NoSuchElementException` if there is no car with the
* specified VIN in the datastructure.
*
* @param vin VIN number of the car to be updated
* @param newPrice The updated price value
*/
public void updatePrice(String vin, int newPrice) throws NoSuchElementException;
/**
* Update the mileage attribute of a given car
* Should throw a `NoSuchElementException` if there is not car with the
* specified VIN in the datastructure.
*
* @param vin VIN number of the car to be updated
* @param newMileage The updated mileage value
*/
public void updateMileage(String vin, int newMileage) throws NoSuchElementException;
/**
* Update the color attribute of a given car
* Should throw a `NoSuchElementException` if there is not car with the
* specified VIN in the datastructure.
*
* @param vin VIN number of the car to be updated
* @param newColor The updated color value
*/
public void updateColor(String vin, String newColor) throws NoSuchElementException;
/**
* Remove a car from the data structure
* Should throw a `NoSuchElementException` if there is not car with the
* specified VIN in the datastructure.
*
* @param vin VIN number of the car to be removed
*/
public void remove(String vin) throws NoSuchElementException;
/**
* Get the lowest priced car (across all makes and models)
* Should return `null` if the data structure is empty
*
* @return Car object representing the lowest priced car
*/
public Car getLowPrice();
/**
* Get the lowest priced car of a given make and model
* Should return `null` if the data structure is empty
*
* @param make The specified make
* @param model The specified model
*
* @return Car object representing the lowest priced car
*/
public Car getLowPrice(String make, String model);
/**
* Get the car with the lowest mileage (across all makes and models)
* Should return `null` if the data structure is empty
*
* @return Car object representing the lowest mileage car
*/
public Car getLowMileage();
/**
* Get the car with the lowest mileage of a given make and model
* Should return `null` if the data structure is empty
*
* @param make The specified make
* @param model The specified model
*
* @return Car object representing the lowest mileage car
*/
public Car getLowMileage(String make, String model);
}