Ask Question
1 October, 12:04

Build a set of parallel vectors of integers that are designed to manage your scores on your labs. One vector holds the score you earned. The second vector holds the maximum possible score. Write the code to populate them with your scores 10/10, 8/10 and 9/10.

+1
Answers (1)
  1. 1 October, 13:50
    0
    import java. util. Vector; public class Main { public static void main (String[] args) { Vector score = new Vector (); Vector maxScore = new Vector (); score. add (10); score. add (8); score. add (9); maxScore. add (10); maxScore. add (10); maxScore. add (10); System. out. println (score. get (1)); System. out. println (maxScore. get (1)); } }

    Explanation:

    The solution is written in Java.

    Since we are going to create Vector, we have to import Vector class into our program (Line 1).

    Next, declare two parallel Vector in integer type (Line 6-7). Score vector is to keep the score earned by user and maxScore is to store maximum possible score.

    Next, we can populate our two vectors using add method (Line 9 - 15).

    We can extract the values stored in the vectors using get method. This get method will accept one index to retrieve the corresponding value from vectors. The Line 17-18 will print out 8 and 10.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Build a set of parallel vectors of integers that are designed to manage your scores on your labs. One vector holds the score you earned. ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers