-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCARRENTAL.java
More file actions
35 lines (30 loc) · 802 Bytes
/
Copy pathCARRENTAL.java
File metadata and controls
35 lines (30 loc) · 802 Bytes
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
import java.util.Scanner;
class CARRENTAL {
int CarId;
String CarType;
float Rent;
void GetCar(int id, String type) {
CarId = id;
CarType = type;
}
float GetRent() {
if (CarType.equals("Small Car"))
Rent = 1000;
else if (CarType.equals("Van"))
Rent = 800;
else if (CarType.equals("SUV"))
Rent = 2500;
return Rent;
}
void ShowCar() {
System.out.println("Car Id: " + CarId);
System.out.println("Car Type: " + CarType);
System.out.println("Rent: " + Rent);
}
public static void main(String[] args) {
CARRENTAL c = new CARRENTAL();
c.GetCar(101, "SUV");
c.GetRent();
c.ShowCar();
}
}