Java Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJava Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old April 23rd, 2008, 02:05 PM
albear albear is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 10 albear User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 32 m 27 sec
Reputation Power: 0
Problem in add method please help

import java.util.*;

public class BoatHireCompany
{
private ArrayList <Boat> theBoats;
// private RowBoat [] theRowBoats;
// private PedalBoat [] thePedalBoats; // private Arraylist <PedalBoat> thePedalBoat = new Arraylist <PedalBoat> (); //should this be in?
private int numRowBoats;
private int maxRowBoats;
private int numPedalBoats;
private int maxPedalBoats;

public BoatHireCompany (int numR, int numP)
{
theBoats = new ArrayList <Boat> (maxRowBoats);
theBoats = new ArrayList <Boat> (maxPedalBoats);
maxRowBoats = numR;
maxPedalBoats = numP;
numRowBoats = 0;
numPedalBoats = 0;

// theBoats = new ArrayList <Boat> (maxBoat);
// theRowBoats = new RowBoat [maxRowBoats];
// thePedalBoats = new PedalBoat [maxPedalBoats];
}


public boolean addRowBoat( Boat newBoats )
{

if ( numRowBoats == maxRowBoats )
{

return false;
}
else
{

theBoats.add(newBoat); THIS IS WHERE IT HAS A PROBLEM BUT I CANT SEEM TO FIGURE OUT HOW TO CORRECT IT
numRowBoats++;
return true;
}

}

Reply With Quote
  #2  
Old May 7th, 2008, 04:05 PM
ricardoz ricardoz is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Location: Montevideo, Uruguay
Posts: 9 ricardoz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 50 m 34 sec
Reputation Power: 0
Your code reads:
theBoats.add(newBoat);

While the parameter name is newBoats (note the "s"). Maybe thats the problem?

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJava Development > Problem in add method please help


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 | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway