View Single Post
  #14 (permalink)  
Old 05-06-2008, 03:15 AM
Bascotie Bascotie is offline
Member
 
Join Date: Apr 2008
Posts: 77
Bascotie is on a distinguished road
Heres what I have so far, now what im trying to do is display the results of the input in the JOptionPane rather than the console and to stop and display an error if:

a. The name of the customer is not blank
b. The phone number of the customer is not blank and doesn’t exceed 10
characters and is an integer with positive number only
c. The number of rolls is between 1 and 100 and is an positive integer
d. The number of prints can only be (1,2,8,10, 25,30,50), positive integer

Code:
public class ProjectDefinition { String userNameFirst; String userNameLast; String userPhone; String userFilm; String userPrints; final int USER_EXPOSURES = 1; public ProjectDefinition(String[] data) { this.userNameFirst = data[0]; this.userNameLast = data[1]; userPhone = data[2]; userFilm = data[3]; userPrints = data[4]; } public String toString() { return "First Name:" + " " + userNameFirst + " " + "Last Name:" + " " + userNameLast + " " + "Phone Number:" + " "+ userPhone + " " + "Rolls of Film:" + " "+ userFilm + " " + "Number of Prints:"+ " " + userPrints; } }
Code:
public class ProjectController { public static void main(String[] args){ DataAcquisition controller = new DataAcquisition(); // Create one PersonData: String[] data = controller.getData(); ProjectDefinition person = new ProjectDefinition(data); System.out.println("person = " + person); } } class DataAcquisition { public String[] getData() { String userInput = JOptionPane.showInputDialog(null, "Please enter the following information with a space inbetween each:\n\n" + "First Name:\n" + "Last Name:\n" + "Phone Number:\n" + "Rolls of Film:\n" + "Number of Prints:"); String[] data = userInput.split("\\s"); return data; }}
Reply With Quote