Codecademy Export - Gists · GitHub

Skip to content Search Gists Search Gists All gists Back to GitHub Sign in Sign up Sign in Sign up Dismiss alert {{ message }}

Instantly share code, notes, and snippets.

@jessicaschilling jessicaschilling/Continents.java Forked from codecademydev/Continents.java Created December 15, 2015 02:54 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
  • Embed Select an option
    • Embed Embed this gist in your website.
    • Share Copy sharable link for this gist.
    • Clone via HTTPS Clone using the web URL.

    No results found

    Learn more about clone URLs Clone this repository at <script src="https://gist.github.com/jessicaschilling/8860830419f328a3ec3c.js"></script>
  • Save jessicaschilling/8860830419f328a3ec3c to your computer and use it in GitHub Desktop.
Code Revisions 1 Embed Select an option
  • Embed Embed this gist in your website.
  • Share Copy sharable link for this gist.
  • Clone via HTTPS Clone using the web URL.

No results found

Learn more about clone URLs Clone this repository at <script src="https://gist.github.com/jessicaschilling/8860830419f328a3ec3c.js"></script> Save jessicaschilling/8860830419f328a3ec3c to your computer and use it in GitHub Desktop. Download ZIP Codecademy export Raw Continents.java This file contains hidden or 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 Show hidden characters
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 You can’t perform that action at this time.

Tag » Codecademy Java Continent