Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Remember me

Go Back   Tutorialized ForumsWeb Design & DevelopmentJava

Add This Thread To:   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
Unread Tutorialized Forums Sponsor:
Old November 24th, 2012, 04:26 AM
C_giov C_giov is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
Join Date: Nov 2012
Posts: 1 C_giov User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 51 sec
Reputation Power: 0
Question 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?

Reply With Quote

Viewing: Tutorialized ForumsWeb Design & DevelopmentJava > New Java student

Developer Shed Advertisers and Affiliates

Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 

Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.

© 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap