-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOrder.java
71 lines (56 loc) · 1.54 KB
/
Order.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
import java.util.Scanner;
public class Order {
long order_id;
String order_item;
double order_amount;
char order_type;
// Constructor
Order(long order_id,
String order_item,
double order_amount,
char order_type) {
this.order_id = order_id;
this.order_item = order_item;
this.order_amount = order_amount;
this.order_type = order_type;
}
// Getters:
public long get_id() {
return order_id;
}
public String get_item() {
return order_item;
}
public double get_amount() {
return order_amount;
}
public char get_type() {
return order_type;
}
// Setters:
public void set_id(long order_id) {
this.order_id = order_id;
}
public void set_item(String order_item) {
this.order_item = order_item;
}
public void set_amount(double order_amount) {
this.order_amount = order_amount;
}
public void set_type(char order_type) {
this.order_type = order_type;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long id = sc.nextLong();
String item = sc.next();
double amount = sc.nextDouble();
char type = sc.next().charAt(0);
Order o = new Order(id, item, amount, type);
System.out.println(o.get_id());
System.out.println(o.get_item());
System.out.println(o.get_amount());
System.out.println(o.get_type());
sc.close();
}
}