-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMileageTracker.java
More file actions
124 lines (90 loc) · 2.43 KB
/
Copy pathMileageTracker.java
File metadata and controls
124 lines (90 loc) · 2.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
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
/**
* This class models a mileage tracker for a car.
*
* @author gcschmit
* @version 27 September 2020
*/
public class MileageTracker
{
private double milesDriven;
private double fuelConsumed;
private String vin;
/*
* 1. Define methods by specifying
* the visibility (public, private)
* return type (e.g., void)
* method name (e.g.
* paramters and their types (e.g., miles of type double)
*
*
*
*/
public MileageTracker(){
this.milesDriven = 0;
this.fuelConsumed = 0;
this.vin = null;
}
public MileageTracker(double initialMilesDriven, double initialFuelConsumed){
this.milesDriven = initialMilesDriven;
this.fuelConsumed = initialFuelConsumed;
}
//just testing out how well the keyboarwwwwwwwwwwwwwwwwwwwwwwww
/**
* Increment number of miles car drove
*/
public void incrementMilesDriven(double miles){
this.milesDriven += miles;
}
/**
*
* return total miles driven
*/
public double getMilesDriven(){
return this.milesDriven;
}
/**
* Increment the number of gallons of fuel that this car has consumed
*
* @param gallons the additional fuel, in gallons, this car has consumed
*/
public void incrementFuelConsumed(double gallons)
{
this.fuelConsumed += gallons;
}
/**
* Returns the total number of gallons of fuel consumed
*
* @return the total number of gallons of fuel consumed
*/
public double getFuelConsumed()
{
return this.fuelConsumed;
}
/**
* Returns the current mileage, in miles per gallon
*
* @return the current mileage, in miles per gallon
*/
public double getMileage()
{
return 0.0;
}
/**
* Returns the vehicle identification (VIN) of this car.
*
* @return the vehicle identification (VIN) of this car
*/
public String getVIN()
{
return null;
}
/**
* Sets the vehicle identification (VIN) of this car.
*
* @param newVIN the vehicle identification (VIN) of this car
*/
public void setVIN(String vin)
{
vin = vin;
}
}