Java Noob

I have started yet another hobby; Java programming. I am just a baby in the grand scheme of things.

After a few chapters in Teach Yourself Java in 24 Hours I wanted to challenge myself to write something totally useless. So I wrote a program whereby the user can calculate how far light travels in miles in a given number of days input by the user.

At first I couldn’t get the final to display the commas within the very large number of miles but found some code and used it to accomplish this. Yes this is a basic “noob” program and it does not have user input validation, nor does it loop back to a start, but this is the beginning for me. So, let’s see what else I can do in the coming days, months and years.
For now, here is the program.

/* Calculate How Far Light Travels in nDays */
/* Version 1.0 */
/* Author Steven Fraser */

import java.util.Scanner; // Import Scanner class
import java.text.DecimalFormat; // This is used to add commas in miles

public class LightSpd { // class is LightSpd

public static void main(String[] args) {
int lightspd = 186000; //Speed of light in miles per second
long seconds;

Scanner sc = new Scanner(;
System.out.print(“Please enter Number of Days: “);
long days = sc.nextLong();

// Let’s get Seconds
seconds = days * 24 * 60 * 60; //convert to seconds
System.out.println(“You entered ” + days + ” day(s)”);

// Final output
System.out.print(“In ” + days);
System.out.print(” day(s) light will travel about “);
long distance = lightspd * seconds;
DecimalFormat myFormatter = new DecimalFormat(“#,###”);
String output = myFormatter.format(distance);
System.out.print(output + ” miles “);

sc.close(); // Close Scanner