View Single Post
  #27 (permalink)  
Old 05-09-2008, 03:46 AM
hardwired hardwired is offline
Senior Member
 
Join Date: Jul 2007
Posts: 1,029
hardwired is on a distinguished road
Code:
import java.util.StringTokenizer; import javax.swing.JOptionPane; public class PC3 { public static void main(String[] args) { ProjectDefinition3 test = new ProjectDefinition3(); System.out.println(test); } } class ProjectDefinition3 { String userFirst; String userLast; String userPhone; String userRolls; String userPrints; final int USER_EXPOSURES = 1; public ProjectDefinition3() { 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); userFirst = st.nextToken(); userLast = st.nextToken(); userPhone = st.nextToken(); userRolls = st.nextToken(); userPrints = st.nextToken(); // From you comments above it seems that this next block // of code could go into a controller class which you would // instantiate/call from the main method in the PC3 class above. String result = "Thank you for choosing Photo Express, " + "Here is your Summary:" + "\n\n" + "First Name:" + " " + userFirst + "\n" + "Last Name:"+ " " + userLast + "\n" + "Phone number:" + " " + userPhone + "\n" + "Number of Rolls:" + " " + userRolls + "\n" + "Number of Prints:" + " " + userPrints; JOptionPane.showMessageDialog(null, result); } public String toString() { return "First Name:" + " " + userFirst + ", " + "Last Name:" + " " + userLast + ", " + "Phone Number:" + " " + userPhone + ", " + "Rolls of Film:" + " " + userRolls + ", " + "Number of Prints:" + " " + userPrints; } }
Reply With Quote