Results 1 to 10 of 10
  1. #1
    tw807b is offline Member
    Join Date
    Jul 2014
    Posts
    5
    Rep Power
    0

    Default Help with ordering system in eclipse

    I don't know where i'm going wrong in my code could someone please go though it and see where my mistake is and how to fix it? this is for a university assignment and i'm not sure what messed up on it. it gives me an error at the end class part some syntax error insert "}" then I do that and it errors out like crazy. please help..


    * Course: IT110 - Introduction to Programming
    * Filename: MyCustomShirtsPhase1.java
    * Created: 04/09/10 by Dr. Debby Telfer
    * Modified: 11/26/13 by Dr. Bary W Pollack
    *
    * Purpose: Created a simple online ordering system
    * for My Custom Shirts customers
    */

    import javax.swing.JOptionPane;

    /**
    * @author Thomas Williams
    */
    public class MyCustomShirtsPhase1 {

    /**
    * @param args
    */
    public static void main(String[] args) {

    // declare variables
    String openingMsg, nameInputMsg, customerName = null, nameOutputMsg,
    returnInputMsg, customerReturn = null, returnOutputMsg,
    greetingOutputMsg, outputMsg,openingMsg1, openingMsg2, openingMsg3, openingMsg4, openingMsg5, openingMsg6, openingMsg7, userid, password, loginMsg = null, pwMsg, invalidEntry = "Invalid Entry"; boolean returnYes, returnNo,returnInvalid, returnName, validCustomer; int returnFlag; //;

    // display opening message
    openingMsg1 = "*** Welcome to My Custom Shirts Online Ordering System ***\n";
    openingMsg2 = "You are now able to order your shirts through our online ";
    openingMsg3 = "Custom Shirt ordering system. \n\n";
    openingMsg4 = "The Shirt types you can order are: ";
    openingMsg5 = "Colorful, Solids, or Stripes \n\n";
    openingMsg6 = "The Shirt sizes you can order are: ";
    openingMsg7 = "Small, Medium, and Large. \n\n";
    openingMsg = openingMsg1 + openingMsg2 + openingMsg3 + openingMsg4 + openingMsg5 + openingMsg6 + openingMsg7;
    JOptionPane.showMessageDialog(null, openingMsg);

    // determine if they are a new or returning customer
    returnInputMsg = "Are you a returning customer (Enter y or n)? ";

    JOptionPane.showInputDialog(returnInputMsg);
    returnYes = customerReturn.equalsIgnoreCase("y");
    returnNo = customerReturn.equalsIgnoreCase("n");
    // initialize return flag if (returnYes) { returnFlag = 1; } else if (returnNo) { returnFlag = 2; } else { returnFlag = 0; }
    // determine if new customer or returning customer switch (returnFlag) { case 1: loginMsg = "Please enter your Current username:";
    userid = JOptionPane.showInputDialog(null, loginMsg);
    pwMsg = "Please enter your Current password: ";
    password = JOptionPane.showInputDialog(null, pwMsg);


    loginMsg = "Please enter your New username:";
    userid = JOptionPane.showInputDialog(null, loginMsg);
    pwMsg = "Please enter your New password: ";
    password = JOptionPane.showInputDialog(null, pwMsg);

    JOptionPane.showMessageDialog(null, invalidEntry);
    loginMsg = "Please enter your New username:";
    userid = JOptionPane.showInputDialog(null, loginMsg);
    pwMsg = "Please enter your New password: ";
    password = JOptionPane.showInputDialog(null, pwMsg);

    // get required customer name

    nameInputMsg = "Enter your name: ";
    customerName = JOptionPane.showInputDialog(nameInputMsg);
    // repeat until a name is XXXXX XXXXX exit after 3 tries for (int i = 1;

    int i = 3; i++; { validCustomer = customerName.isEmpty();
    if (validCustomer) { JOptionPane.showMessageDialog(null, invalidEntry);
    if (i == 3) { System.exit(0);
    } else { nameInputMsg = "Enter your name: ";

    customerName = JOptionPane.showInputDialog(nameInputMsg);}
    } else { }


    // build output strings nameOutputMsg = "Welcome " + customerName + ".\n"; returnOutputMsg = "Your login is: " + userid + "/" + password + ".\n";
    greetingOutputMsg = "Thank you for My Custom Shirts!" + "\n";

    // create output string outputMsg = nameOutputMsg + returnOutputMsg + greetingOutputMsg;

    // display output message JOptionPane.showMessageDialog(null, outputMsg);

    System.exit(0);


    } // end main()

    } // end class

  2. #2
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    947
    Rep Power
    2

    Default Re: Help with ordering system in eclipse

    There is a curly brace missing at the end after //end class.

    I might add that your curly braces are a mess. Make a habit of starting a new line after a curly brace like this:
    Java Code:
    if ( condition) {
       someAction();
    }
    else {
       anotherAction();
    }
    That way you can never miss one.
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  3. #3
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    947
    Rep Power
    2

    Default Re: Help with ordering system in eclipse

    And here starts the mess:
    Java Code:
    // repeat until a name is XXXXX XXXXX exit after 3 tries for (int i = 1;
    
    int i = 3; i++; { validCustomer = customerName.isEmpty();
    if (validCustomer) { JOptionPane.showMessageDialog(null, invalidEntry);
    if (i == 3) { System.exit(0);
    } else { nameInputMsg = "Enter your name: ";
    
    customerName = JOptionPane.showInputDialog(nameInputMsg);}
    } else { }
    Examine this. Do you see the for part being commented out, but the part after i++ is not? There is an extra curly brace.
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  4. #4
    tw807b is offline Member
    Join Date
    Jul 2014
    Posts
    5
    Rep Power
    0

    Default Re: Help with ordering system in eclipse

    ok so exactly what do I need to take out this is all greek to me

  5. #5
    tw807b is offline Member
    Join Date
    Jul 2014
    Posts
    5
    Rep Power
    0

    Default Re: Help with ordering system in eclipse

    this is the exact error I get on line 90 Syntax error, insert "}" to complete ClassBody

  6. #6
    tw807b is offline Member
    Join Date
    Jul 2014
    Posts
    5
    Rep Power
    0

    Default Re: Help with ordering system in eclipse

    this is a screenshot of my stuff in eclipse and the error
    Help with ordering system in eclipse-my-code.jpg

  7. #7
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,049
    Rep Power
    6

    Default Re: Help with ordering system in eclipse

    Quote Originally Posted by tw807b View Post
    ok so exactly what do I need to take out this is all greek to me
    Compare your code to Surfman's. I hope you can agree that Surfman's is readable and yours is 100% unreadable. Of course you don't see what you need to do.

    Tidy it up first in exactly the way Surfman did it. Use proper indenting.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  8. #8
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    947
    Rep Power
    2

    Default Re: Help with ordering system in eclipse

    I hope you can count in Greek, because that is what you have to do. Every opening brace *must* have a closing one. Apparently, your code is missing a }. If you want an easy way of managing (curly) braces, you need to indent your code properly. The mainstream of Javacoders indents the code like I did in reply #2.

    Since you're using Eclipse, you can ask Eclipse to format your code for you, and then you can see where things go wrong. Hint: it starts going wrong at line 67.
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  9. #9
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,036
    Rep Power
    20

    Default Re: Help with ordering system in eclipse

    Oh...joy.
    Please only post once in this forum when asking a question...I just replied to your other thread in the Eclipse sub forum.

    I'll go and close that one, shall I?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  10. #10
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,049
    Rep Power
    6

    Default Re: Help with ordering system in eclipse

    Quote Originally Posted by surfman View Post
    since you're using eclipse, you can ask eclipse to format your code for you
    (ctrl + shift + f)
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. HELP!! Ordering system in Eclipse
    By tw807b in forum Eclipse
    Replies: 1
    Last Post: 07-23-2014, 09:08 AM
  2. Replies: 10
    Last Post: 12-12-2012, 12:04 PM
  3. Replies: 1
    Last Post: 12-05-2012, 08:57 PM
  4. Importing old System into eclipse
    By FlyNn in forum Advanced Java
    Replies: 2
    Last Post: 12-13-2010, 05:46 PM
  5. Eclipse - shortcut to System.out.println
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 11-07-2007, 04:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •