Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

Visual Basic


  • Please log in to reply

#1
Sissyb321

Sissyb321

    New Member

  • Member
  • Pip
  • 1 posts
Can someone help me? I am a newbie in programming.

------------------------------------
Your GUI will have the following inputs. There will be an input textbox for each one.

1. The variable A
2. A color which shall be a String

It will also have a Do It! button. When the user clicks the button, your program will update the following output text boxes:
1. the sum of A values for which the color was "red"
2. the sum of the A values for which the color is "blue"
3. the sum of the A values for which the color is "green"

If the inputs for sets A, B, C are:

32 Red
17 blue
22 green
24 blue
23 red

the output would be

red Sum 55 blue sum 41 green sum 22


Can anyone share the code on how to construct this?
  • 0

Advertisements


#2
RykoL

RykoL

    New Member

  • Member
  • Pip
  • 2 posts
Hello
First of all this Forum is not for doing your Homework. So do you already have some Code?
  • 0

#3
AceInfinity

AceInfinity

    Visiting Staff

  • Visiting Consultant
  • 34 posts
  • MVP
This is probably long overdue, so the way I would have done this is with a Dictionary<TKey, TValue> generic collection. Check if the key for the color of type string exists, and if it does, add to the value, otherwise create a new KeyValuePair for the dictionary, and initialize the value to the value that is to be added.
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP