Programming Intro 2

Programming Intro 2 – I am creating an local interstellar map which identifies the closest 50 galaxies near the Milky Way galaxy. While I am creating this map, I am showing introductory programming processes so people may learn from the code and progress of the code.

The map will build over time and I will build in a GUI and extra functionality; it is a cool thing to see something start from scratch and built up over time. Please feel free to check out the code in Programming Intro 2: (will be improved upon; winging it. haven’t coded in a while).

You can do the same thing with the code snippet below using the previous code we used in programming intro.

Programming Intro 3

Programming Intro 1

code snippet:


String[] galaxyarrdata =
{"SagDEG", "sagdeg", "81000",
"Large Magellanic Cloud", "lmc", "160000",
"Small Magallanic Cloud", "smc", "190000",
"Ursa Minor Dwarf", "umd", "205500",
"Draco Dwarf", "draco", "248000",
"Sculptor Dwarf", "sculptor", "254000",
"Sextans Dwarf", "sextans", "257000",
"Carina Dwrf", "carina", "283500",
"Fornax Dwarf", "fornax","427000",
"Leo II", "leoli","701000",
"Leo I", "leo", "890000",
"Phoenix Dwarf", "phoenix", "127100",
"Barnards Galaxy (NGC6822)", "ngc8822", "1760000",
"NGC185", "ngc185","2021000",
"NGC147", "ngc147","2162000",
"Andromeda M31", "Adromeda","2363000",
"M32 (NGS221)", "ngs221","2353500",
"M110 (NGC 205)", "ngs205","2363500",
"Andromeda I", "andromedai","2363500",
"Andromeda II", "andromediaii", "2353500"
};

    System.out.println("\r\n");  
    System.out.println("The closest solar system to Earth is Alpha Centauri "  + acLY + " light years away");
    System.out.println("\r\n");  
    System.out.println("The closest galaxy to Earth is Canis Major dwarf " + cmdLY + "k light years away"); 
    System.out.println("\r\n");

    int r = 0;

    for(r=0; r<galaxyarrdata.length; r=r+3)
    {
        System.out.print("The galaxy " +  galaxyarrdata[r] +  " is " + galaxyarrdata[r+2]   + " light years away");
        System.out.println("\r\n");    

        String tempvar = galaxyarrdata[r+2];
        String varname = galaxyarrdata[r+1];

        /*
        System.out.println(tempvar);
        System.out.println(varname); 
        */  
    };    

Leave a Reply

%d bloggers like this: