Sometimes is it necessary to create a method that converts numbers. This is the way to convert numbers in Java/Eclipse.

package P;

import java.io.PrintStream;
import java.util.Scanner;

public class C {
	static final double GB_IN_MB = 1000;

	PrintStream out;
	Scanner in;

	C() {
		out = new PrintStream(System.out);
		in = new Scanner(System.in);
	}
	
	void start() {
		out.printf("Enter the number of GB(s): ");
		double numberOfGBs = in.nextDouble();
		in.close();

		double numberOfMBs = numberOfGBs * GB_IN_MB;
		out.printf("%f GB equals %f MB\n", numberOfGBs, numberOfMBs);
	}

	public static void main(String[] args) {
		new C().start();

	}

}

Explanation:

  1. create a package
  2. create a class
  3. import the PrintStream and Scanner class.
  4. Set theĀ constant: GB_IN_MB = 1000;
  5. Ask for input
  6. Calculate the output
  7. Finally, print the output

If you want to go back to the instruction to convert from hours to hours;minutes;seconds, click here.