Created
November 8, 2017 08:11
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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