-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathelseIf.java
More file actions
28 lines (25 loc) · 972 Bytes
/
elseIf.java
File metadata and controls
28 lines (25 loc) · 972 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
/**
* Created by fattyduck on 3/8/15.
*/
import java.util.Scanner;
public class elseIf {
public static void main(String[] args){
Scanner cow=new Scanner(System.in);
int people, trains, cars, total;
System.out.println("Let me know how many people, buses, and cars are in the city and I will let you know the fast way to enter city");
System.out.println("How many people are there");
people=cow.nextInt();
System.out.println("How many trains are there?");
trains=cow.nextInt();
System.out.println("How many cars are there?");
cars=cow.nextInt();
total=cars+people;
if(total<=20){
System.out.println("Traveling in a car is your fastest option!");
}else if(total>=50){
System.out.println("Traveling in a train is your fastest option!");
}else{
System.out.println("Traveling on feet is your fastest option!");
}
}
}