Hey guys,
I hope you can help me with this, I've been trying to get it right all day..
First I'll post my project so far and then my questions under, thank you.
import javax.swing.JOptionPane;
public class kmbproject1 {
public static void main(String[] args)
{
String userName = "";
String userPhone = "";
String userFilm;
String userPrints = "";
int userExposures = 1;
userName = JOptionPane.showInputDialog(null, "Please enter your name");
if (userName.equals(""))
{JOptionPane.showMessageDialog(null, "Exiting the program!");
System.exit(0);}
userPhone = JOptionPane.showInputDialog(null, "Please enter your phone number");
if (userPhone.equals(""))
{JOptionPane.showMessageDialog(null, "Exiting the program!");
System.exit(0);}
userFilm = JOptionPane.showInputDialog(null, "How many rolls of film will we be developing for you?");
userPrints = JOptionPane.showInputDialog(null, "How many 4 x 6 prints would you like to have made out of each film?");
}
}
here is what I've been trying to do (some of which is done):
Display an error message and close the program if:
a. the name of the customer is not blank
b. the phone number of the customer is not blank and doesnt exceed 10 characters
c. the number of rolls is between 1 and 100
d. the number of exposures is 1
e. the number of prints can only be (1,2,8,10,,25,30,50)
So far, with help thank God, I was able to do (a) and the not blank part of (b)
But I cant seem to do c right now because I cant do an if statement like:
if (userFilm.length < 10) because i get a cannot convert from string to int error.
If you have the answer please show me the coding examples, im getting answers sometimes which I try and do not work, if I dont understand I will post to try and understand them further and I will also reply if they plain dont work. I really appreciate all help, thank you!