Question: NETBEANS 12.5, JAVA, JAVA8.0 Exercises to start working with Vectors 1. Write a program to which we pass 5 numbers, store them in an array
NETBEANS 12.5, JAVA, JAVA8.0
Exercises to start working with Vectors
1. Write a program to which we pass 5 numbers, store them in an array and display the array with the following format:
[23, 43, 1, -3, 6]
2. Write a program that fills an array of integers with numbers from 1 onwards (0,1, 2, 3, 4... up to the size of the array).
3. Write a program that fills us with an array of integers with the numbers in descending order (4,3,... up to 0).
4. Write a program that fills an array of integers with random numbers.
5. Write a program that reads multiple numbers, stores them in an array of integers, and tells you if the elements in the array are in ascending order. You can use a boolean variable to solve the problem.
6. It writes a program that requests N numbers, stores them in a vector, and displays on the screen, the largest, the smallest, the sum, and the mean.
7. Writes a program that requests N grades (between 0 and 10), stores them in a vector, and displays on the screen, how many students have passed and how many have failed from the total. For example, for N=10, if they have passed 5 and failed 5, the program output should be:
- There are 5 approved, 50% of the total.
- There are 5 failings, 50% of the total.
8. Writes a program that requests N numbers and stores them in a vector. The values of that vector will then be copied to another vector.
Displays the values of both vectors.
9. Writes a program that requests N numbers and stores them in a vector. It then requests other N numbers and stores them in a second vector. Finally, it saves the sum of the values of the first and second vector to another vector. Displays the values of the 3 vectors.
Example:
v1 = [1,2,3]
v2 = [1,2,3]
v3 = [2,4,6] (sum)
10. Write a program that requests a positive number between 1000 and 9999. The program will then store each figure separately in a 4-element vector. Finally, the program must indicate if it is a capica number.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
