-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEight1.java
More file actions
29 lines (24 loc) · 736 Bytes
/
Eight1.java
File metadata and controls
29 lines (24 loc) · 736 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
import java.util.Scanner;
class Eight1
{
public static void main(String[] Strings)
{
Scanner input = new Scanner(System.in);
int speed, speed_limit, excess_speed, fine;
System.out.print("Enter the speed limit:");
speed_limit = input.nextInt();
System.out.print("Enter vehicle's speed:");
speed = input.nextInt();
excess_speed = speed - speed_limit;
if(speed > speed_limit && excess_speed < 30)
{
System.out.print("Fine = Ksh.2,500");
System.out.print("\nExcess_speed:" + excess_speed);
}
else
{
System.out.print("Fine = Ksh.4,000");
System.out.print("\nExcess_speed:" + excess_speed);
}
}
}