Question: C4.1. Write a simple program in java that randomly generates 1,000,000 integers (yes, one million integers) in the range of 1 and 10 (including 1

C4.1. Write a simple program in java that randomly generates 1,000,000 integers (yes, one million integers) in the range of 1 and 10 (including 1 and 10) and uses an array of integers that stores the counts for the numbers of 1s, 2s, 10s. Once the random integers have been generated and the counts stored in the array, display the contents of the array and show the results.

C4.2. Write a method in java that returns the sum of all the elements in the last column in a 6x6 matrix using the following method header: public static int sumLastColumn (int[][] array2D) Write a simple test program that declares and initializes a 6x6 2D array with initial values (you decide on the values, but it cannot be all zeros) and call the sumLastColumn method and then displays the sum of the values in the last column of the matrix (2D array).

C4.3. (In Java) Design a public class named Rectangle to represent a rectangle. The class contains: double data fields width and length with default values of 2 for width and 3 for length Two constructor methods: o A no-argument contructor that creates a default rectangle o A contructor that creates a rectangle with the specified width and length in the formal parameters A method named getPerimeter() that returns the perimeter A method named getArea() that returns the area Write a simple test program like we did in class that creates two Rectangle objects: rect1 with default values for width and length rect2 with width = 3.5 and length = 6.3 Display the perimeter and area of each rectangle.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!