Question

Use VbScript to go through an array of colors. Create a loop to get the next...

Use VbScript to go through an array of colors.

Create a loop to get the next 2 elements of an array in vbscript.

The array is Colors = Array("red", "blue, "green", "yellow", "purple", "orange", "marroon", "cream", "violet", "teal")

Output should be:
Red Blue green
Blue Green Yellow
Purple Orange Marroon
Cream Violet Teal
Violet Teal Red
Teal Red Blue

For each element in the array, get the next 2 elements
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:

Raw code:

Module Module1
Sub Main() 'declaring the function
'creating an array of given strings
Dim Colors() As String = {"red","blue","green","yellow","purple","orange","marron","cream","violet","teal"}
Dim len As Integer = Colors.Length 'declaring the len variable with lenght of Colors array
For i As Integer = 0 To Colors.Length - 1
'for printing the required output
Console.WriteLine("{0} {1} {2}",UCase(Left(Colors(i Mod len), 1)) & Mid(Colors(i Mod len), 2),
UCase(Left(Colors((i+1) Mod len), 1)) & Mid(Colors((i+1) Mod len), 2),
UCase(Left(Colors((i+2) Mod len), 1)) & Mid(Colors((i+2) Mod len), 2))
'UCase(Left(Colors(i Mod len), 1)) this captlise the fist letter
'mod is for to over the come problem of array goes out of bound
Next
End Sub
End Module

note: please make indentation according to the screen shot of the editor

code screen shot:

out put:

Add a comment
Know the answer?
Add Answer to:
Use VbScript to go through an array of colors. Create a loop to get the next...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Python problem: 1. The colors red, blue, and yellow are known as the primary colors because...

    Python problem: 1. The colors red, blue, and yellow are known as the primary colors because they cannot be made by mixing other colors. When you mix two primary colors, you get a secondary color, as shown here: When you mix red and blue, you get purple. When you mix red and yellow, you get orange. When you mix blue and yellow, you get green. Create a text file with the names of two colors in it. Write a program...

  • In Java: Create an array of Integers with 10 elements, loop (use a for loop) through...

    In Java: Create an array of Integers with 10 elements, loop (use a for loop) through the array of integers printing their values to the screen. Create an array of Strings with 10 elements, loop (use a for loop) through the array of Strings printing their values to the screen. Finally, create an ArrayList of Integers. Use the loop from part 1 above and add each integer as you print it to the ArrayList as well, then start a final...

  • For each of the solutions described below, determine the pH range for the solution using the...

    For each of the solutions described below, determine the pH range for the solution using the information given and the indicator chart Solution A Indicator Used alizarin yellow Indicator color Yellow bromthymol blue yellow methyl violet violet Range bear the 21 less than 7.6 leathen lib really them 5.1 Gooher the 3.2 bromcresol green green methyl red red The pH range for solution A is 3.2 7.6 Solution B Indicator Used methyl red Indicator color yellow Range leroth 67 alizarin...

  • Use the Table 7.1, estimate the pH of following solutions. The colors of the 4 indicators...

    Use the Table 7.1, estimate the pH of following solutions. The colors of the 4 indicators in the solution are given. Explain your answer a. Solution A 2. 3. Make studie acid s you g your pre-l thymol blue: yellow methyl orange: yellow methyl red: orange bromothymol blue: yellow Range of pH b. Solution B thymol blue: yellow methyl orange: yellow methyl red: yellow bromothymol blue: blue Range of pH Row C: methyl red Row D: bromthymol blue 4. Swirl...

  • (2) Recall the following fact: In any planar graph, there exists a vertex whose degree is s 5 Use...

    (2) Recall the following fact: In any planar graph, there exists a vertex whose degree is s 5 Use this fact to prove the six-color theorem: for any planar graph there exists a coloring with six colors, i.e. an assignment of six given colors (e.g. red, orange, yellow, green, blue, purple) to the vertices such that any two vertices connected by an edge have different colors. (Hint: use induction, and in the inductive step remove some verter and all edges...

  • Plain M&M's come in 6 different colors (Blue, Orange, Green, Yellow, Red, Brown) and are produced...

    Plain M&M's come in 6 different colors (Blue, Orange, Green, Yellow, Red, Brown) and are produced at two different plants. M&M's that come from a plant in Tennessee are supposed to have the following distribution of colors: 20.7% Blue; 20.5% Orange; 19.8% Green; 13.5% Yellow; 13.1% Red and 12.4% Brown. Quality control at the plant is concerned the machine is not working correctly and that it is producing a different distribution of colors. They take a random sample of 940...

  • 13) The value of the resistance R1 of colors (Red, Black, Black, and Gold) is: Red...

    13) The value of the resistance R1 of colors (Red, Black, Black, and Gold) is: Red Black Gold Gold: 5% Silver 1023 (A) (2052) 22 (B) (20:1) (C) (200+ 10) 2 (D) (2007 20) 2 (E) (27 0.1) Black: 0 Brown: 1 Red: 2 Orange : 3 Yellow : 4 Green: 5 Blue : 6 Violet:7 Gray: 8 White: 9 14) Which of the following equations is correct when applying Kirchhoff loop rule for the circuit shown below (A) 6...

  • Compare the flame test and solution reaction observations for the unknown to the observations for the known solution...

    Compare the flame test and solution reaction observations for the unknown to the observations for the known solutions. Identify the metal present in your unknown solution and circle it below. Strontium Sodium Lithium Potassium Barium Calcium Report Sheet Questions For 1) and 2) below use all six metals (from above), but use each only once. 1. A fireplace log is available for the holiday season that burns with a green and red flame. Based on your observations, which elements produce...

  • In a recently purchased pack of peanut M&M's, 9 of the 65 peanut M&M's were brown....

    In a recently purchased pack of peanut M&M's, 9 of the 65 peanut M&M's were brown. If we were to use this sample to create a 95% confidence interval, we would get an interval (0.055 < p < 0.222). The Task - buy a package of M&Ms, the package must be larger than a fun-size (+50 pieces) - determine the claimed population percentage of each color M&M (see below) - record the total number of each color M&M in your...

  • Emission line spectra for various elements are shown in Table 1 and Table 2 shows the...

    Emission line spectra for various elements are shown in Table 1 and Table 2 shows the wavelengths for various colors. Remember, E = h*c/?, where E is energy, h = 6.626*10-34 J*s, c = 3.00*108 m/s, ? is the wavelength, and 1 m = 109 nm. Table 1. Emission Line Spectra of Various Elements Element Emission Lines (nm) H 410.2, 434.1, 486.1, 656.3 He 447.1, 492.1, 501.5, 587.5 Hg 404.7, 435.8, 546.1, 577.0 Na 588.9, 589.5 Mg 487.8, 502.5, 574.1,...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT