Need Urgent Help with missing method in my code

Need help woth 'GetRidOfTheSmallWidgets(colBoxesOfWidgets)'

Page 1 of 1

1 Replies - 908 Views - Last Post: 14 August 2008 - 06:13 PM Rate Topic: -----

#1 singhs2  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 33
  • Joined: 22-December 07

Need Urgent Help with missing method in my code

Post icon  Posted 14 August 2008 - 08:55 AM

I would begrateful if someone could help me with one of the missing methods code:
GetRidOfTheSmallWidgets(colBoxesOfWidgets). The method is meant to get rid of all of the widgets with lengths less than 20. would anyone know the java equivelant to the method?? Thank you

using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace ConsoleApplication1
{
	class Program
	{
		static void Main(string[] args)
		{
			ArrayList colBoxesOfWidgets = new ArrayList();

			colBoxesOfWidgets.Add(new BoxOfWidgets("Cardboard"));
			((BoxOfWidgets)colBoxesOfWidgets[0]).colWidgets.Add(new Widget("The blue widget", 12));
			((BoxOfWidgets)colBoxesOfWidgets[0]).colWidgets.Add(new Widget("The red widget", 15));
			((BoxOfWidgets)colBoxesOfWidgets[0]).colWidgets.Add(new Widget("The silver widget", 6));
			((BoxOfWidgets)colBoxesOfWidgets[0]).colWidgets.Add(new Widget("The green widget", 52));

			colBoxesOfWidgets.Add(new BoxOfWidgets("Metal"));
			((BoxOfWidgets)colBoxesOfWidgets[1]).colWidgets.Add(new Widget("The gold widget", 9));
			((BoxOfWidgets)colBoxesOfWidgets[1]).colWidgets.Add(new Widget("The orange widget", 115));
			((BoxOfWidgets)colBoxesOfWidgets[1]).colWidgets.Add(new Widget("The pink widget", 1));

			colBoxesOfWidgets.Add(new BoxOfWidgets("Metal"));
			((BoxOfWidgets)colBoxesOfWidgets[2]).colWidgets.Add(new Widget("The grey widget", 12));
			((BoxOfWidgets)colBoxesOfWidgets[2]).colWidgets.Add(new Widget("The black widget", 15));
			((BoxOfWidgets)colBoxesOfWidgets[2]).colWidgets.Add(new Widget("The white widget", 19));
			((BoxOfWidgets)colBoxesOfWidgets[2]).colWidgets.Add(new Widget("The brown widget", 60));
			((BoxOfWidgets)colBoxesOfWidgets[2]).colWidgets.Add(new Widget("The peach widget", 16));


			GetRidOfTheSmallWidgets(colBoxesOfWidgets); //NEED HELP HERE PLEASE
		}


		public ArrayList GetRidOfTheSmallWidgets(ArrayList colBoxesOfWidgets){

			//Place your code in here
			//It should remove all widgets that have lengths lower than 20.

			return colBoxesOfWidgets;

		}
	}

	class BoxOfWidgets
	{
		public string boxType;
		public ArrayList colWidgets;

		public BoxOfWidgets(string newBoxType)
		{
			boxType = newBoxType;
			colWidgets = new ArrayList();
		}
	}

	class Widget
	{
		public string name;
		public float length;

		public Widget(string newName, float newLength)
		{
			this.name = newName;
			this.length = newLength;
		}
	}


}



Is This A Good Question/Topic? 0
  • +

Replies To: Need Urgent Help with missing method in my code

#2 Jayman  Icon User is offline

  • Student of Life
  • member icon

Reputation: 418
  • View blog
  • Posts: 9,532
  • Joined: 26-December 05

Re: Need Urgent Help with missing method in my code

Posted 14 August 2008 - 06:13 PM

[rules][/rules]
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1