• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Need help with assignment please.

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As stated above, its on line 16 and 17 only
The whole error codes are: error: ';" expected
and '.class' expected.

Im getting both of these error codes on both lines.
 
Ranch Hand
Posts: 208
9
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But you changed it back to what it was before, right?

 
Sev Marc
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yea I changed it back to that and still getting errors
 
Tina Smith
Ranch Hand
Posts: 208
9
Eclipse IDE Firefox Browser Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A quick google search on that error says that there is somewhere in that line/those lines where you are specifying the type (eg int) when it is not required. Like you had before you changed it back.

Obvious question: you did save the file, right?
 
Sev Marc
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes I did save it.
Anyhow, I will repost in this thread tomorrow because its getting late here. I just want to thank you very much for your time and helping me fix my stupid beginner mistakes. I really appreciate it, I will post here again if I got any more issues/questions
 
Sev Marc
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok so my latest issue is in the cases:

Showing cannot find symbol for addition, subtraction and the rest. How Could i fix that?
Thanks.

I also changed some stuff. Instead of
Making string input, I made it a char,
 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sev,

I think you really need to read much of our FAQ here. I would focus on these in particular:

  • TellTheDetails
  • IsolateTheProblem
  • UseCodeTags


  • and possibly glance at the other topics where the title isn't clear what is meant.

    You keep making vague posts that don't really tell us what help you need. When you post your code, you don't use code tags. When you post an error message, it is key that you post the full and complete message, along with your current code (with code tags!!!).

    Your job is to make it as easy as possible for people to help you. If you don't, they will get frustrated and stop. Saying things like "Showing cannot find symbol for addition, subtraction and the rest." isn't helpful. Programming is all about being specific and precise. All you need to do is cut'n'paste the error text into your post here.

    help us help you!!!
     
    Sheriff
    Posts: 17644
    300
    Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Sev Marc wrote:Write a Java program (FractionDemo) with the main method) that, using the class Fraction, performs operations on fractions.


    If you were to follow these instructions, your program should look something like this:

    The format string passed to printf() on lines 9 and 10 will call the Fraction.toString() method that you are instructed to override.

    Note also that private members of a class instance are directly accessible by other instances of the same class, so you really don't need to access the numerator and denominator fields via getters in the implementations of the add, subtract, etc. methods. There may be those who object to that approach and insist that you should use getters to access private members but I would cite Joshua Bloch's recipe for equals() and note that he takes advantage of this ability to arguably break encapsulation of other instances of the same class; if it's good enough for Joshua Bloch, it's good enough for me.
     
    reply
      Bookmark Topic Watch Topic
    • New Topic