View Single Post
  #28 (permalink)  
Old 05-09-2008, 04:06 AM
Bascotie Bascotie is offline
Member
 
Join Date: Apr 2008
Posts: 77
Bascotie is on a distinguished road
hardwired, you truly are.
Thanks so much man, I had it correct but I just couldnt figure out how to split it so I was gonna submit this code I was working on after I added the calculations and whatnot:

Code:
public class ProjectDefinition { final int USER_EXPOSURES = 1; public static void main(String[] args) { String choice = "y"; while (choice.equalsIgnoreCase("y")) { try{ String input = JOptionPane.showInputDialog ( "Welcolme to Photo Express" + "Please enter the following seperated by spaces:\n\n" + "First Name:" + "\n" + "Last Name:" + "\n" + "Phone Number:" + "\n" + "Number of Rolls" + "\n" + "Number of Prints" + "\n" + "\n" + "Example:Monkey Luffy 6265554321 5 8" ); StringTokenizer st = new StringTokenizer(input); String result; String userFirst = st.nextToken(); String userLast = st.nextToken(); String userPhone = st.nextToken(); int userPhoneTwo = Integer.parseInt(userPhone); if (userPhone.length() > 10 || userPhoneTwo < 0) { JOptionPane.showMessageDialog(null, "Phone number cannot be longer than 10 digits and must be a positive integer"); System.exit(0);} String userRolls = st.nextToken(); int userRollsTwo = Integer.parseInt(userRolls); if (userRollsTwo < 1 || userRollsTwo > 100) { JOptionPane.showMessageDialog(null, "Number of Rolls must be positive between 1 and 100"); System.exit(0);} String userPrints = st.nextToken(); result ="Thank you for choosing Photo Express, Here is your Summary:" + "\n\n" + "First Name:" + " " + userFirst + "\n" + "Last Name:"+ " " + userLast + "\n" + "Phone number:" + " " + userPhoneTwo + "\n" + "Number of Rolls:" + " " + userRollsTwo + "\n" + "Number of Prints:" + " " + userPrints; JOptionPane.showMessageDialog(null, result); choice = JOptionPane.showInputDialog(null, "Continue? (y/n)"); } catch(NoSuchElementException e) { JOptionPane.showMessageDialog(null, "You must fill in all information"); } } } }
Reply With Quote