File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes I keep getting an error message in my code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "I keep getting an error message in my code" Watch "I keep getting an error message in my code" New topic
Author

I keep getting an error message in my code

Donna Gary
Greenhorn

Joined: Apr 17, 2011
Posts: 3
//Class: IT/215 Week Five Inventory Program 1

Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3827

Welcome to JavaRanch, Donna Gary

You don't have "unitPrice" member variable in the Television class but you try to use them through accessor method?

And next time make sure you post error message(s) so that people can easily see what the problem is.


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Donna Gary
Greenhorn

Joined: Apr 17, 2011
Posts: 3
I am sorry I forgot to post the error message a little frustrated.

C:\Documents and Settings\AdminUser\MyDocuments\InventoryPart1.java:81: ')' expected nf.formatsamsung.calculateInventoryTotal)); ^ 1 error Tool completed with exit code 1

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19683
    
  20

That's not the error I get. I get 5 errors, three of which relate to missing field "unitPrice", one about a non-existing constructor (hint: your Television constructor has 4 parameters but you try to call it with 5), and one about missing method "calculateInventoryTotal()".


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3827

Ok. I'll tell you what's wrong with the code in more detail...

If you compile the given code above you'll get total of five errors. Three of them are related to the member variable "unitprice" and one about the wrong constructor used in line 64 and the use of non existing method in line 76.

You have to define a member variable called "unitprice" as you've done with "itemNumber" etc..
As shown below you are using the Television constructor with five argument where the defined constructor only has four.

And you don't have a method named "calculateInventoryTotal()" in the Television class but you try to call that method in line 76.

Fix those issues then it should compile.

Edit: Rob has already given the tips about the code
Donna Gary
Greenhorn

Joined: Apr 17, 2011
Posts: 3
Your tips were helpful, I made corrections to the errors but now I am still getting 1 error as follows:

C:\Documents and Settings\AdminUser\My Documents\InventoryPart1.java:84: reached end of file while parsing
}
^
1 error

Tool completed with exit code 1
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14116
    
  16

That means you have mismatched { and } somewhere in your code. Carefully look at all the braces in your code, and check if you open and close all of the blocks with braces correctly.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38508
    
  23
Reached end of file when parsing usually means you have more {s than }s, but I can't see any such imbalanced {} in what you posted.
 
 
subject: I keep getting an error message in my code