hello everyone,
I am new to Java and I am struggling with my latest assignment that deals with methods. I am unable to figure out what I am doing wrong. Could someone give me advice and tell me what is wrong with my code and advice on how to fix it. I think once I get a little push I can start to really understand.
Here is my program so far. I am unable to figure out the method that deals with the getStringInput(String prompt).
public class Headbands4UPhase1 {
/**
* @param args
*/
public static void main(String[] args) {
// declare variables
String openingMsg, nameInputMsg, customerName, nameOutputMsg,
returnInputMsg, customerReturn, returnOutputMsg,
greetingOutputMsg, outputMsg,headbandColor,colorInputMsg, colorOutputMsg, jewelInputMsg, jewelOutputMsg, jewelOption;
// display opening message
openingMsg = "*** Welcome to Headbands4U Online Ordering System ***\n"
+ " It's a great day to order a headband!";
JOptionPane.showMessageDialog(null, openingMsg);
}
// get required input using dialogs
private static String getStringInput(String prompt){
String customerName;
return customerName;
String customername = "Please enter your name: ";
JOptionPane.showMessageDialog(null, "Please enter your name");
if (customerName==null)
{JOptionPane.showMessageDialog(null, "Error. Please enter your name:", customerName, 3);
}
Thankyou for your time!
Mary
I am new to Java and I am struggling with my latest assignment that deals with methods. I am unable to figure out what I am doing wrong. Could someone give me advice and tell me what is wrong with my code and advice on how to fix it. I think once I get a little push I can start to really understand.
Here is my program so far. I am unable to figure out the method that deals with the getStringInput(String prompt).
public class Headbands4UPhase1 {
/**
* @param args
*/
public static void main(String[] args) {
// declare variables
String openingMsg, nameInputMsg, customerName, nameOutputMsg,
returnInputMsg, customerReturn, returnOutputMsg,
greetingOutputMsg, outputMsg,headbandColor,colorInputMsg, colorOutputMsg, jewelInputMsg, jewelOutputMsg, jewelOption;
// display opening message
openingMsg = "*** Welcome to Headbands4U Online Ordering System ***\n"
+ " It's a great day to order a headband!";
JOptionPane.showMessageDialog(null, openingMsg);
}
// get required input using dialogs
private static String getStringInput(String prompt){
String customerName;
return customerName;
String customername = "Please enter your name: ";
JOptionPane.showMessageDialog(null, "Please enter your name");
if (customerName==null)
{JOptionPane.showMessageDialog(null, "Error. Please enter your name:", customerName, 3);
}
Thankyou for your time!
Mary