Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Page 2 of 3 FirstFirst 123 LastLast
Results 26 to 50 of 64

Thread: Java Programming project

  1. #26
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,067
    Thanks
    47
    Thanked 2,146 Times in 2,119 Posts

    Default Re: Java Programming project

    it show error
    You need to copy and post the full text of error messages.

    If you are having problems with mismatched {}s, some IDEs have a tool you can use to find the pairing {}s
    On my IDE put the cursor just before a { and press: Ctrl and ] and the cursor will move to the pairing }.
    Another way to pair {}s is to print the source on a piece of paper and use a pencil to draw lines from a { to its pairing }. Start at an inner most pair and move out.

    Please edit your post and wrap your code with
    [code=java]
    <YOUR CODE HERE>
    [/code]
    to get highlighting and preserve formatting.
    If you don't understand my answer, don't ignore it, ask a question.

  2. #27
    Member
    Join Date
    Mar 2013
    Posts
    68
    My Mood
    Angelic
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Java Programming project

    Errors: ----jGRASP exec: javac -g Muffler.java

    Muffler.java:72: error: reached end of file while parsing
    }//end computeCost
    ^
    Muffler.java:78: error: reached end of file while parsing

    ^
    2 errors

    ----jGRASP wedge2: exit code for process is 1.
    ----jGRASP: operation complete.

  3. #28
    Super Moderator curmudgeon's Avatar
    Join Date
    Aug 2012
    Posts
    1,130
    My Mood
    Cynical
    Thanks
    64
    Thanked 139 Times in 134 Posts

    Default Re: Java Programming project

    Again, please post your code with code tags. Please look at Norm's post to see how to do this. Again, you need to put the effort in to find matches for all of your braces. Again this isn't rocket science, since all you need to do is match 'em. Please have at it.

  4. #29
    Member
    Join Date
    Mar 2013
    Posts
    68
    My Mood
    Angelic
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Java Programming project

    public void computeCost()
    {}
    double priceCost = 39.95;
    switch(C)
    {}
    [case (A): cost = priceCost * 1.00;
    case (A3): cost = priceCost * 41.95;
    case (B): cost = priceCost * 1.07;
    case (B3): cost = priceCost * 44.89;
    case (BL): cost = priceCost * 48.10;
    case (C): cost = priceCost * 1.15;
    case (C3): cost = priceCost * 48.24;
    case (CL): cost = priceCost * 51.69;
    case (D): cost = priceCost * 1.22;
    case (D3): cost = priceCost * 51.18;
    case (DL): cost = priceCost * 54.84;
    case (E): cost = priceCost * 1.38;
    case (E3): cost = priceCost * 57.89;
    case (EL): cost = priceCost * 62.03;
    case (F3): cost = priceCost * 62.92;
    case (FL): cost = priceCost * 67.42]


    <return cost>
    {}//[end computeCost]
    Like this?

  5. #30
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,067
    Thanks
    47
    Thanked 2,146 Times in 2,119 Posts

    Default Re: Java Programming project

    What does the compiler say?

    Please edit your post and wrap your code with
    [code=java]
    <YOUR CODE HERE>
    [/code]
    to get highlighting and preserve formatting.
    If you don't understand my answer, don't ignore it, ask a question.

  6. #31
    Member
    Join Date
    Mar 2013
    Posts
    68
    My Mood
    Angelic
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Java Programming project

    that i have 55 errors

  7. #32
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,067
    Thanks
    47
    Thanked 2,146 Times in 2,119 Posts

    Default Re: Java Programming project

    i have 55 errors
    Not a record, not even close.

    How many errors before your last change? Restore the code to the old version and try again.
    If you don't understand my answer, don't ignore it, ask a question.

  8. #33
    Member
    Join Date
    Mar 2013
    Posts
    68
    My Mood
    Angelic
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Java Programming project

    1 error: {//end computeCost
    i will try again with the old version

  9. #34
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,067
    Thanks
    47
    Thanked 2,146 Times in 2,119 Posts

    Default Re: Java Programming project

    Print the source and use a pencil to connect a { to its pairing }
    Start at the inside and work out.
    If you don't understand my answer, don't ignore it, ask a question.

  10. #35
    Member
    Join Date
    Mar 2013
    Posts
    68
    My Mood
    Angelic
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Java Programming project

    what source? you mean my code?

  11. #36
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,067
    Thanks
    47
    Thanked 2,146 Times in 2,119 Posts

    Default Re: Java Programming project

    Yes, by source I meant your code before it is compiled.
    If you don't understand my answer, don't ignore it, ask a question.

  12. #37
    Member
    Join Date
    Mar 2013
    Posts
    68
    My Mood
    Angelic
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Java Programming project

    i did that

  13. #38
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,067
    Thanks
    47
    Thanked 2,146 Times in 2,119 Posts

    Default Re: Java Programming project

    And?
    If you don't understand my answer, don't ignore it, ask a question.

  14. #39
    Member
    Join Date
    Mar 2013
    Posts
    68
    My Mood
    Angelic
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Java Programming project

    and do you want me to compile it

  15. #40
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,067
    Thanks
    47
    Thanked 2,146 Times in 2,119 Posts

    Default Re: Java Programming project

    I don't know why you would wait for someone to tell you to compile the program. Compilations are free. I compile frequently when writing a program. Its better to have fewer errors with frequent compiles rather than wait and get lots of errors.
    If you don't understand my answer, don't ignore it, ask a question.

  16. #41
    Member
    Join Date
    Mar 2013
    Posts
    68
    My Mood
    Angelic
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Java Programming project

    i know ,I didn't mean to and it don't worked so i have to go back to my old version and compile successfully and move on next method 1 new errors: public String updatePriceCode(String PriceCode)

  17. #42
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,067
    Thanks
    47
    Thanked 2,146 Times in 2,119 Posts

    Default Re: Java Programming project

    You need to copy the full text of the error messages and paste them here. We're here and you're there. We can't see what is on your PC's screen.
    If you don't understand my answer, don't ignore it, ask a question.

  18. #43
    Member
    Join Date
    Mar 2013
    Posts
    68
    My Mood
    Angelic
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Java Programming project

    public class Muffler
    {

    private String customer;
    private String priceCode;
    private double cost;

    public Muffler()
    {
    String customer = "Williams";
    String priceCode = "A" ;
    double cost = 39.95;

    }//end Muffler

    public Muffler(String inName, String inPriceCode)
    {
    customer = inName;
    priceCode = inPriceCode;
    computeCost();
    }//end Muffler

    public String getCustomer()
    {
    return customer;

    }//end getCustomer

    public String getPriceCode()
    {
    return priceCode;

    }//end getPriceCode

    public double getCost()
    {
    return cost;

    }//end getCost

    public String setCustomer(String newCustomer)
    {
    return customer;
    }//end setCustomer

    public void computeCost()
    {
    [double priceCost = 39.95]
    <switch()
    {
    case(A): cost = priceCost * 1.00;
    break;
    case(A3): cost = priceCost * 41.95;
    break;
    case(B): cost = priceCost * 1.07;
    break;
    case(B3): cost = priceCost * 44.89;
    break;
    case(BL): cost = priceCost * 48.10;
    break;
    case(C): cost = priceCost * 1.15;
    break;
    case(C3): cost = priceCost * 48.24;
    break;
    case(CL): cost = priceCost * 51.69;
    break;
    case(D): cost = priceCost * 1.22;
    break;
    case(D3): cost = priceCost * 51.18;
    break;
    case(DL): cost = priceCost * 54.84;
    break;
    case(E): cost = priceCost * 1.38;
    break;
    case(E3): cost = priceCost * 57.89;
    break;
    case(EL): cost = priceCost * 62.03;
    break;
    case(F3): cost = priceCost * 62.92;
    break;
    case(FL): cost = priceCost * 67.42;
    break>

    [if(priceCode.length(x>1))
    {

    if(priceCode [1] == ("3"))

    priceCost += 2.00;

    else if(priceCode [1]==("L"))
    priceCost+= 5.00;

    else
    cost=9999.99;
    }
    }

    }//end computeCost]

    public String updatePriceCode(String PriceCode)
    {
    return priceCode;
    }//end updatePriceCode

    public String toString()
    {
    return " ";
    }//end

    }//end class Muffler


    Muffler.java:49: error: illegal start of expression
    switch()
    ^
    1 error

    ----jGRASP wedge2: exit code for process is 1.
    ----jGRASP: operation complete.

  19. #44
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,067
    Thanks
    47
    Thanked 2,146 Times in 2,119 Posts

    Default Re: Java Programming project

    You've coded the switch statement many times in this thread and have always had a value inside the ()s. This time you left it out and the compiler finds it as an error.

    Please edit your post and wrap your code with
    [code=java]
    <YOUR CODE HERE>
    [/code]
    to get highlighting and preserve formatting.
    If you don't understand my answer, don't ignore it, ask a question.

  20. #45
    Member
    Join Date
    Mar 2013
    Posts
    68
    My Mood
    Angelic
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Java Programming project

    i edited my post

  21. #46
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,067
    Thanks
    47
    Thanked 2,146 Times in 2,119 Posts

    Default Re: Java Programming project

    Which post? What did you change?
    If you don't understand my answer, don't ignore it, ask a question.

  22. #47
    Member
    Join Date
    Mar 2013
    Posts
    68
    My Mood
    Angelic
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Java Programming project

    I change from switch() to switch (c). Should I put down "c" or "cost". i hope this work this time.

  23. #48
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,067
    Thanks
    47
    Thanked 2,146 Times in 2,119 Posts

    Default Re: Java Programming project

    If you don't understand my answer, don't ignore it, ask a question.

  24. #49
    Member
    Join Date
    Mar 2013
    Posts
    68
    My Mood
    Angelic
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Java Programming project

    i did that. the compiler won't correct my error like can't find" the symbol everything i put down word or inital in it

  25. #50
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,067
    Thanks
    47
    Thanked 2,146 Times in 2,119 Posts

    Default Re: Java Programming project

    the compiler won't correct my error
    Not yet. They are working on it. But for now the programmer has to correct his own errors.

    If you need help with the errors, copy the full text of the error messages and paste it here.
    If you don't understand my answer, don't ignore it, ask a question.

Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. android programming vs game programming using java
    By vgoel38 in forum Android Development
    Replies: 4
    Last Post: September 8th, 2012, 05:48 PM
  2. java programming 2 project
    By kin93 in forum Java Theory & Questions
    Replies: 6
    Last Post: June 16th, 2012, 12:00 AM
  3. Jukebox Programming project
    By joneslay_d in forum What's Wrong With My Code?
    Replies: 4
    Last Post: December 2nd, 2010, 01:48 PM
  4. Replies: 2
    Last Post: August 1st, 2010, 06:29 AM
  5. Programming partner that can earn revenue
    By Jay in forum Project Collaboration
    Replies: 0
    Last Post: May 25th, 2009, 02:33 PM