View Single Post
  #8   Spotlight this post!  
Unread 30-03-2005, 11:08
AIBob's Avatar
AIBob AIBob is offline
AI Programmer
AKA: Bob Frank DOT org
FRC #0358 (Hauppauge Robotic Eagles)
Team Role: Alumni
 
Join Date: Jan 2005
Rookie Year: 2003
Location: Long Island, NY (in Binghamton now)
Posts: 297
AIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to behold
Send a message via ICQ to AIBob Send a message via AIM to AIBob Send a message via MSN to AIBob Send a message via Yahoo to AIBob
Re: Java headache problem

Quote:
Originally Posted by MisterX - edited in RED
feast your eyes on 31 errors of pure Java!

public class SellStock
{
double price;
double numbers;
double value;
double commission;
double rate;
double proceeds;

public SellStock()
{
//these variables need to be.
price = 0;
numbers = 0;
value = 0;
commission = 0;
rate = 0;
proceeds = 0;

}
public void addPrice(double count)
{
price = price + count;
}
public void addNumbers(int count)
{
numbers = numbers + count;
}
public void addRate(double count)
{
rate = rate + count;
}
public void addValue()
{
value = price * numbers; //don't miss semi-colons
}
public void addCommission (double rate)
{
commission = value * (rate/100);
}
public double getProceeds()
{
return value - commission;
}
}
/*
public
*/
class SellStockTest
{
public static void main(String[] args)
{
SellStock iSellStock = new SellStock();
iSellStock.addPrice(10.125);
iSellStock.addNumbers(11);
iSellStock.addCommission(1.5);
double totalValue = iSellStock.getProceeds();
System.out.print("This program calculates the net proceeds from a sale of stock to be:");
System.out.println(totalValue/*getProceeds*/);
}
}
Those are the only errors that were found with the compiler I used...
Hope its better
__________________
- from B B frank