Skip to content

Instantly share code, notes, and snippets.

@sunnyeyez123
Created November 8, 2017 08:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sunnyeyez123/6a4e8fadaede433cbbcbc658704d8cd7 to your computer and use it in GitHub Desktop.
Save sunnyeyez123/6a4e8fadaede433cbbcbc658704d8cd7 to your computer and use it in GitHub Desktop.
print out a continent and the largest city in that continent, based on the value of an integer.
/* print out a continent and the largest city in that continent, based on the value of an integer. */
public class Continents {
public static void main(String[] args) {
int continent =4;
switch(continent){
case 1:
System.out.println("North America: Mexico City, Mexico");
break;
case 2:
System.out.println("South America: Sao Paulo, Brazil");
break;
case 3:
System.out.println("Europe: Moscow, Russia");
break;
case 4:
System.out.println("Africa: Lagos, Nigeria");
break;
case 5:
System.out.println("Asia: Shanghai, China");
break;
case 6:
System.out.println("Australia: Sydney, Australia");
break;
case 7:
System.out.println("Antarctica: McMurdo Station, US");
break;
default:
System.out.println("Undefined continent!");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment