Welcome to Dream.In.Code
Getting C# Help is Easy!

Join 136,504 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 1,726 people online right now. Registration is fast and FREE... Join Now!




Need Urgent Help with missing method in my code

 
Reply to this topicStart new topic

Need Urgent Help with missing method in my code, Need help woth 'GetRidOfTheSmallWidgets(colBoxesOfWidgets)'

singhs2
14 Aug, 2008 - 07:55 AM
Post #1

New D.I.C Head
*

Joined: 22 Dec, 2007
Posts: 33



Thanked: 2 times
My Contributions
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

CODE

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;
        }
    }


}

User is offlineProfile CardPM
+Quote Post

Jayman
RE: Need Urgent Help With Missing Method In My Code
14 Aug, 2008 - 05:13 PM
Post #2

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 6,947



Thanked: 42 times
Dream Kudos: 500
Expert In: C#, VB.NET, Java

My Contributions
Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Please post like this:

Thank you for helping us helping you.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 08:29PM

Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month