All pastes #731515 Raw Edit

Untitled

public java v1 · immutable
·published 2007-10-10 03:26 UTC
rendered paste body
import javax.swing.JOptionPane;import java.lang.Integer;import java.lang.Double;public class BrukVolum {	public static void main(String[] args) {		// Variable declarations.		String lengthInput;		String widthInput;		String heightInput;		int length = 0;		int width = 0;		int height = 0;		int PackageNumber = 1;		int PackageChosen = 0;		Object[] PackageOptions = {"Cylindrical", "Rectangular"};		Object[] ProgramOptions = {"New Package", "Show Results"};	do {		// Will the package details be for a cylindrical or rectangular package?		int PackageChoice = JOptionPane.showOptionDialog(null, "Choose your package type", "Choose package type", JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE,null, PackageOptions, PackageOptions[0]);		if (PackageChoice == 0) {			// Just let the user know what type of package he chose ..			System.out.println("Cylindrical package type chosen.");			// Keep track of which package we're reading values for			PackageNumber = PackageNumber + 1;			// Let the user input values for package number <X>			lengthInput = JOptionPane.showInputDialog("Cylindrical Package #"+PackageNumber+".\nLength: ");			widthInput = JOptionPane.showInputDialog("Cylindrical Package #"+PackageNumber+".\nWidth: ");			heightInput = JOptionPane.showInputDialog("Cylindrical Package #"+PackageNumber+".\nHeight: ");			length = Integer.parseInt(lengthInput);			width = Integer.parseInt(widthInput);			height = Integer.parseInt(heightInput);			// Allow the user to choose how to continue			int ProgramChoice = JOptionPane.showOptionDialog(null, "How do you want to continue?", "How do you want to continue?", JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE,null, ProgramOptions, ProgramOptions[0]);		} else if (PackageChoice == 1) {			System.out.println("Rectangular package type chosen.");		}	} while (ProgramChoice == 0);	} // END METHOD 'main'} // END CLASS 'BrukVolum'