JOptionFeetInchConvert

JOptionFeetInchConvert - S feetString =...

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

View Full Document Right Arrow Icon
// 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;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: S feetString = JOptionPane.showInputDialog ("Enter a number in feet: "); ( feet = Double.parseDouble(feetString); f inches = feet * INCHES_IN_FOOT; i JOptionPane.showMessageDialog(null, feet + " feet is " + inches + " inches."); f String inchesString = JOptionPane.showInputDialog ("Now, enter a whole number in inches: "); ( wholeInches = Integer.parseInt(inchesString); w feet = wholeInches / INCHES_IN_FOOT; f JOptionPane.showMessageDialog(null, wholeInches + " inches is " + feet + " feet."); 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