All pastes #499520 Raw Edit

Something

public text v1 · immutable
·published 2007-05-21 02:59 UTC
rendered paste body
		case 4:
						
					//
					//Compute sum of price of all sailboats and powerboats
					//
	
					//sum total prices by type of boat
					for (Boat bt : boatList)
					{
						if (bt instanceof SailBoat)
						{	//Sailboat
							SailBoat sb = (SailBoat) bt;
							totalSail += sb.calcPrice();
						}
						else
						{	//PowerBoat
							PowerBoat bp = (PowerBoat) bt;
							totalPower += bp.calcPrice();
						}
					}//end for
					break;