CSE110 Lab 10 Solved

35.00 $

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

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

Securely Powered by: Secure Checkout

Description

Rate this product

 

This lab is for practicing the object-oriented programming, and you need to implement a Student Class and implement a simple system to modify and view user information. Use the following Coding Guidelines:
• When declaring a variable, you usually want to initialize it.

• Use white space to make your program more readable.
• Use comments after the ending brace of classes, methods, and blocks to identify to which block it belongs.

Assignments Documentation:

At the beginning of each programming assignment you must have a comment block with the

following information:

/*—————————————————————————

// AUTHOR:
// FILENAME:
// SPECIFICATION:
// You need to develop the setName() method of Student Class and construct a simple system
// that can manage a student’s name and age
// LAB LETTER: (Put your Lab Letter here) //————————————————————————- */
Getting Started
Create a class called Lab10. Use the same setup for setting up your class and main method as you did for the previous assignments. Be sure to name your file Lab10.java.

The instructions of the assignment are as follows:

// import all and anything you need //–>

public class Lab9 {

//Declare the main method //–>
{

Scanner in = new Scanner(System.in);

// Create four 4 x 4 matrices (2D Integer Array) mat_A, mat_B, mat_C and mat_D

//Hint: Read the values row wise
//For example: If the input is 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16. //Then matrix will be:
1234
5678
9 1011 12
13 14 15 16

//Declare three 2D arrays with 4 rows and 4 columns an example is shown below

(Put your name here) Lab10.java

This program is for practicing the object-oriented programming.

//int [] [] mat_A = new int [4] [4];

// Similarly create mat_B, mat_C and mat_D // –>
// –>
// –>

// Read vales into matrix A and B // Print “Enter values into mat_A:” // –>

// Display the mat_A
// Print “Matrix A is ” for(int i = ? ; ?? ; ?){

for(int j = ? ; ?? ; ?){

// –> }

}

Print “Enter values into mat_B:” // –>

// Display the mat_B // Print “Matrix B is ” // –>

Task 1:

//Matrix Addition: Add the two matrices mat_A and mat_B and store the new matrix in mat_C

for (int i = ? ; ?? for (int j = ? ;

; ?){
?? ; ?){

// –> }

}

  • //  Display the mat_C
  • //  Print “Addition of two matrices: Matrix C is ”
  • //  –>

    Task 2:

    // Calculate the sum of elements of matrix C and display the value // Declare an integer value <sum>
    // –>

for (int i = ? ; ?? ; ?){
for (int j = ? ; ?? ; ?){

// –> }

}

  • //  Print “Sum of elements of matric C is <sum>”
  • //  –>

    Task 3:

    //Find transpose of matrix C and store the new matrix in mat_D
    //Hint: The new matrix D will have rows which are columns of the original matric C //The transpose of the matrix mentioned in the above example will be:
    1 5 9 13
    2 6 10 14
    3 7 11 15
    4 8 12 16

for (int i = ? ; ?? for (int j = ? ;

; ?){

?? ; ?){
mat_D [?] [?] = mat_C [?] [?];

// –> }

}

  • //  Display the mat_D
  • //  Print “Transpose of matrix C is: ”
  • //  –>

    } }

    Sample Input:

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

    Sample Output:

Enter values into mat_A: 1234 5678 9 10 11 12 13 14 15 16

Enter values into mat_B: 1234 5678 9 10 11 12 13 14 15 16

Addition of two matrices: Matrix C is 2468
10 12 14 16
18 20 22 24

26 28 30 32

Sum of elements of matrix C is 272

Transpose of matrix C is 2 10 18 26 4 12 20 28 6 14 22 30 8 16 24 32

  • 10-de0at1.zip