
November 24th, 2012, 03:26 AM
|
|
Registered User
|
|
Join Date: Nov 2012
Posts: 1
Time spent in forums: 4 m 51 sec
Reputation Power: 0
|
|
New Java student
I am a new Java student and we just started using NetBeans in class using an online textbook for homework/study. Here's my issue:
I need to define a Coffee class to use for calculation examples. I already defined it and it took :
class Coffee {
String kind;
int price;
int weight;
Coffee(String kind, int price, int weight) {
this.kind = kind;
this.price = price;
this.weight = weight;
}
Now, the next thing i needed to do is to compute total cost, i re-read the chapter and tried it over and over again. This is what I have:
int cost () {
return (this.price ∗ this.weight);
}
} <-- (this bottom bracket closes it still inside the Coffee class definition)
My textbook has this as an example in the book but when I try it in netbeans it just gives me errors saying "missing return statement" and "not a statement". What am I doing wrong?
|