windows - if (thedata == null) return; int sec1 =...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package windows; import javax.swing.*; // For JFrame import java.awt.*; // For Color and Container import java.util.Scanner; /** * * @author */ public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { int totaldeg, totalmin, totalsec, carrymin, carrydeg; final String DEGREE_SYMBOL = "º"; //<html>º</html>"; Scanner input = new Scanner(System.in); String mystring = "Enter the degrees of the first angle: "; String thedata = JOptionPane.showInputDialog(mystring, "0"); if (thedata == null) return; int deg1 = Integer.parseInt(thedata); mystring = "Enter the minutes of the first angle: "; thedata = JOptionPane.showInputDialog(mystring, "0"); if (thedata == null) return; int min1 = Integer.parseInt(thedata); mystring = "Enter the seconds of the first angle: "; thedata = JOptionPane.showInputDialog(mystring, "0");
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: if (thedata == null) return; int sec1 = Integer.parseInt(thedata); mystring = "Enter the degrees of the second angle: "; thedata = JOptionPane.showInputDialog(mystring, "0"); if (thedata == null) return; int deg2 = Integer.parseInt(thedata); mystring = "Enter the minutes of the second angle: "; thedata = JOptionPane.showInputDialog(mystring, "0"); if (thedata == null) return; int min2 = Integer.parseInt(thedata); mystring = "Enter the seconds of the second angle: "; thedata = JOptionPane.showInputDialog(mystring, "0"); if (thedata == null) return; int sec2 = Integer.parseInt(thedata); totalsec=(sec1+sec2)%60; carrymin=(sec1+sec2)/60; totalmin=(min1+min2+carrymin)%60; carrydeg=((min1+min2)/60)+carrymin; totaldeg=(deg1+deg2+carrydeg)%360; String s = "Your sum is: " +totaldeg +DEGREE_SYMBOL +" "+totalmin +"\' "+totalsec+"\""; JOptionPane.showMessageDialog(null, s); } }...
View Full Document

This homework help was uploaded on 04/07/2008 for the course CSCI 161 taught by Professor Webster during the Spring '08 term at Millersville.

Page1 / 2

windows - if (thedata == null) return; int sec1 =...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online