Ask Question
17 February, 08:53

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.

+5
Answers (1)
  1. 17 February, 10:08
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers