Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created December 15, 2015 02:54
Show Gist options
  • Save codecademydev/66699f1d52e713e27767 to your computer and use it in GitHub Desktop.
Save codecademydev/66699f1d52e713e27767 to your computer and use it in GitHub Desktop.
Codecademy export
public class Continents {
public static void main(String[] args) {
//This little program takes an inputted continent number and matches it to a text string of the largest city and country on that continent
//Here's that continent number
int continent = 4;
switch (continent) {
//And here are all the cases of what to output with each numbered 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("Antarctica: McMurdo Station, US");
break;
default: System.out.println("Undefined continent!");
break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment