SOLVED: Numbercollectiaon.java

24.99 $

Category:
Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: rar solution files instantly, after Payment

Securely Powered by: Secure Checkout

Description

5/5 - (3 votes)

1. Write the declaration and initialization of a char array with 12 elements initialized to ‘$’. Use the most appropriate loop. 2. Given char [ ] letter s= { ‘a’ , ‘b’, ‘c’ , ‘d’, ‘e’ }, what is the value of letters[3]? 3. Write a declaration for an integer array and initialize the second element to the number 5. 4. What is the value of the 5th element? int[] array = new int[17]; for(int i = 2; i<= 16; i++) { if(i%2 == 0) array[i] = 2; else array[i] = 1; } Your assignment is to create a class called NumberCollection in a file called NumberCollection.java. (there is no main method in this class). A class NumberCollection has an array of integers and a count (integer) as instance variables. The variable count keeps track of how many integers are stored in the array. The variable name for the array of integers is numberArray. Note: You need to distinguish the array size (capacity) and “count” that keeps track of numbers added to this array so far.

  • Numbercollection.java-1.rar