Question

a) Declare and instantiate an array named scores of twenty-five elements of type int.   (b)Write a...

a) Declare and instantiate an array named scores of twenty-five elements of type int.  

(b)Write a statement that declares an array namedstreetAddress that contains exactly eighty elements of typechar.

2. In a single statement: declare, create and initialize an arraynamed a of ten elements of type int with the values of the elements (starting with the first) set to 10, 20,..., 100 respectively.
3. Declare an array reference variable, week, and initialize it to an array containing the strings "mon", "tue", "wed", "thu", "fri", "sat", "sun" (in that order).
4. printArray is a method that accepts one argument, an arrayof int. The method prints the contents of the array; it does not return a value. inventory is an array of int that has been already declared and filled with values. Write a statementthat prints the contents of the array inventory by calling the method printArray using a declared and instantiated object named obj.
5. Write the definition of a method printArray, which has one parameter, an array of int . The method does not return a value. The method prints out each element of the array, on a line by itself, in the order the elements appear in the array, and does not print anything else.
6. Write a method definition named makeString that will accept a variable parameter list of characters and return them as a single string.
7. Declare a two dimensional array named ticTacToe with the appropriate type and size.
8. Assign a default value (any value you like based on the correct type you used in question 8) to each element of the ticTacToe array declared in question 8, using a nested forloop.
9. Define a method that accomplish question 8. The method is named fillInTwoDimArray, and returns nothing but accepts a two-dimensional array.
10. Change the values of the following empty cells to x’s or o’s (Does not matter which) based on your answer to question 7.

X

O

O

X

X

X

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Hi, I have answered first 5 Questions.

I have answered in Java as you have not mentioned any programming language.

a) Declare and instantiate an array named scores of twenty-five elements of type int.  

Ans: int [] scores = new int[25];

(b)Write a statement that declares an array named streetAddress that contains exactly eighty elements of typechar.

Ans: char[] streetAddress = new char[8];

2. In a single statement: declare, create and initialize an array named a of ten elements of type int with the values of the elements (starting with the first) set to 10, 20,..., 100 respectively.

Ans: int[] a = new int[]{10,20,30,40,50,60,70,80,90,100};

3. Declare an array reference variable, week, and initialize it to an array containing the strings "mon", "tue", "wed", "thu", "fri", "sat", "sun" (in that order).

Ans: String[] week = {"mon", "tue", "wed", "thu", "fri", "sat", "sun"};

4. printArray is a method that accepts one argument, an arrayof int. The method prints the contents of the array; it does not return a value. inventory is an array of int that has been already declared and filled with values. Write a statementthat prints the contents of the array inventory by calling the method printArray using a declared and instantiated object named obj.

Ans: obj.printArray(inventory);

Please repost others in separate post.

Add a comment
Know the answer?
Add Answer to:
a) Declare and instantiate an array named scores of twenty-five elements of type int.   (b)Write a...
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
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