Question
JAVA PLEASE ANSWER ASAP, PLEASE. Program a class as depicted below, with the main function. public class Array { public static void main(String[] args) {
JAVA PLEASE ANSWER ASAP, PLEASE.
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.
[3 points] Write code to prompt the user to input the number of rows and columns for this array t.
[3 points] 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started