Check03B - o seconds = KEPLERCONSTANT *...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.io.PrintStream; import java.util.Scanner; i public class Check03B { public static void main(String[] args) { final double KEPLERCONSTANT = 0.00995, POWER = 3.0/2.0; final int EARTHRADIUSKM = 6378, MINUTES = 60, SECONDS = 60; int sAltitudeKm; double seconds, hours, minutes; String buffer; S Scanner input = new Scanner(System.in); PrintStream output = System.out; P try { output.print("Enter the satellite altitude in km . .. "); buffer = input.nextLine(); sAltitudeKm = Integer.parseInt(buffer); output.println("*********************************************");
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: o seconds = KEPLERCONSTANT * Math.pow((sAltitudeKm + EARTHRADIUSKM), POWER); E hours = seconds / (MINUTES * SECONDS); minutes = (hours - Math.floor(hours)) * MINUTES; seconds = (minutes - Math.floor(minutes)) * SECONDS; s output.printf("Orbital period = %d hours, %d minutes, and %.1f seconds.%n", (int)hours, (int)minutes, seconds); } catch (NumberFormatException nfe) { output.println("Non-integer value entered."); } } }...
View Full Document

Ask a homework question - tutors are online