Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Program a class as depicted below, with the main function. public class Array { public static void main(String[] args) { 1). 2). . . 12).

Program a class as depicted below, with the main function.

public class Array {

public static void main(String[] args) {

1).

2).

.

.

12).

}

}

Instructions:

Provide code for each section from 1) to 12) as outlined in the instructions listed in section 1 to 12 below.

In your program, consider a two-dimensional integer array referred to as t.

Write code to prompt the user to input the number of rows and columns for this array t.

Write a statement that declares and creates t (using rows and cols from step 1.).

[3 points] Print out how many elements does t have.

[2 points] Write a single statement that sets the element of t in row 0 and column 1 to zero.

[3 points] Write a nested for statement that initializes each element of t to zero.

[3 points] Write a nested for statement that inputs the values for the elements of t from the user.

[3 points] Write a series of statements that determines and displays the smallest value in t.

[3 points] Write a single printf statement that displays the elements of the first row of t.

[3 points] Write a statement that totals the first 2 elements of the third column of t. Do not use iteration.

[6 points] Write a series of statements that displays the contents of t in tabular format. List the column indices as headings across the top, and list the row indices at the left of each row.

[3 points] Write a method, call it sum, that returns the sum of any two elements of the array t passed in as parameters.

[5 points] Using the return value of sum from step 11 above, write a switch statement that tests the sum's return value and displays day of the week starting with 0 for SUNDAY, 1 for Monday and the rest of the weekdays accordingly. Any number above 6 should display Day invalid.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Power Of Numbers In Health Care A Students Journey In Data Analysis

Authors: Kaiden

1st Edition

8119747887, 978-8119747887

More Books

Students also viewed these Databases questions

Question

1. What is meant by Latitudes? 2. What is cartography ?

Answered: 1 week ago

Question

What is order of reaction? Explain with example?

Answered: 1 week ago