JOptionFeetInchConvert

JOptionFeetInchConvert - S feetString =...

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

// File: JOptionFeetInchConvert.java // Course: CSC 211 // Author: Amber Settle // Purpose: A version of the application to prompt for a number of // feet and convert to inches, and then prompt for a number // of inches and convert to feet that uses the JOptionPane // class. / import javax.swing.JOptionPane; i public class JOptionFeetInchConvert { // Prompt for feet and convert to inches. // Next, prompt for inches and convert to feet. / public static void main(String[] args) { final double INCHES_IN_FOOT = 12.0; double feet, inches; int wholeInches; String feetString;
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: S feetString = JOptionPane.showInputDialog (&quot;Enter a number in feet: &quot;); ( feet = Double.parseDouble(feetString); f inches = feet * INCHES_IN_FOOT; i JOptionPane.showMessageDialog(null, feet + &quot; feet is &quot; + inches + &quot; inches.&quot;); f String inchesString = JOptionPane.showInputDialog (&quot;Now, enter a whole number in inches: &quot;); ( wholeInches = Integer.parseInt(inchesString); w feet = wholeInches / INCHES_IN_FOOT; f JOptionPane.showMessageDialog(null, wholeInches + &quot; inches is &quot; + feet + &quot; feet.&quot;); w System.exit(0); } }...
View Full Document

This note was uploaded on 03/05/2011 for the course CSCI 384 taught by Professor Drchan during the Spring '11 term at CA Health Sciences.

Ask a homework question - tutors are online