/* London Undgerground Information bot
This program will notify the user which zones their chosen London Underground stations are in.
Author Tsotne Gvadzabia
*/
import java.util.Scanner;
class underground
{
public static void main (String[]p)
{ String station;
welcomemsg();
station=convers();
if (station.equalsIgnoreCase("Mile End"))
{
System.out.println(station+" is in Zone "+ mileEnd()); //goes to method mile end and returns its value here
}
else if(station.equalsIgnoreCase("Liverpool Street"))
{
System.out.println(station+" is in Zone "+liver()); //goes to method liver and returns its value here
}
else if (station.equalsIgnoreCase("Woodford"))
{
System.out.println(station+" is in Zone "+wood()); //goes to method wood and returns its value here
}
else if (station.equalsIgnoreCase("Oxford Circus"))
{
System.out.println(station+" is in Zone "+oxford()); //goes to method oxford and returns its value here
}
else if (station.equalsIgnoreCase("Wimbledon"))
{
System.out.println(station+" is in Zone "+wimbo()); //goes to method wimboand and returns its value here
}
else if (station.equalsIgnoreCase("Sloane Square"))
{
System.out.println(station+" is in Zone "+sloane()); //goes to method sloane and returns its value here
}
else
{
System.out.println("Is " + station +" a London Underground Station? Maybe check your spelling.");
System.out.println("Please be advised I am still in early development, therefore not every station has been entered into my database");
}
System.exit(0);
}
public static void welcomemsg()
{
System.out.println("Hello! This is the Underground Information Bot speaking. Use me to find out what zones specific stations are in");
System.out.println("Loading....");
return;
}
public static String convers()
{
String station;
Scanner scanner = new Scanner(System.in);
System.out.println("Please enter the Underground Station that you need to know the zone of");
station= scanner.nextLine(); //gets the station from user
return station; //Returns station value
}
public static int mileEnd()
{
return 2; //Returns zone value
}
public static int liver()
{
return 1; //Returns zone value
}
public static int wood()
{
return 4; //Returns zone value
}
public static int oxford()
{
return 1; //Returns zone value
}
public static int wimbo()
{
return 3; //Returns zone value
}
public static int sloane()
{
return 1; //Returns zone value
}
}
This Program tells the user what zone the station they input is in.
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.