|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#3
|
|||||
|
|||||
|
Re: Java headache problem
feast your eyes on 31 errors of pure Java!
File 1: public class SellStock { public SellStock() { 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 } public void addCommission (double rate) { commission = value * (rate/100); } public double getProceeds() { return value - commission; } } File 2: 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(getProceeds); } } Last edited by MisterX : 30-03-2005 at 11:01. |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Strange Encoder Problem | AIBob | Electrical | 3 | 20-02-2005 22:20 |
| Programming Problem: Extremely Frustrating | chantilly_team | Programming | 19 | 12-02-2005 23:00 |
| Java Books | Yan Wang | Programming | 1 | 27-12-2002 16:26 |
| The problem with scouting... | archiver | 2001 | 10 | 23-06-2002 23:49 |
| Major problem with chipphua motors | aka Scott White | Motors | 18 | 19-03-2002 19:44 |