forked from baur100/JavaCore2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyFile.java
More file actions
44 lines (38 loc) · 1.12 KB
/
MyFile.java
File metadata and controls
44 lines (38 loc) · 1.12 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
public class MyFile {
public static void main(String[] args){
System.out.println("Hello, Git");
int res = mult3(3, 3, 5);
System.out.println(res);
int price = 220;
int age1=32;
int age2=30;
int age3=68;
int age4=5;
double age5=1.8;
System.out.println("pers1=" + ticketPrice(age1,price));
System.out.println("pers2=" + ticketPrice(age2,price));
System.out.println("pers3=" + ticketPrice(age3,price));
System.out.println("pers4=" + ticketPrice(age4,price));
System.out.println("pers5=" + ticketPrice(age5,price));
}
public static double ticketPrice (double age, double price){
double ticketPrice = price;
if (age<2){
ticketPrice = 0;
}
if (age>=2 && age>+12){
ticketPrice = price*0.5;
}
if (age>12 && age<66){
ticketPrice=price;
}
if (age>=66){
ticketPrice=price*0.8;
}
return ticketPrice;
}
public static int mult3(int a, int b, int c){
int x = a*b*c;
return x;
}
}