Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

CSC1003 Assignment 2

Important Notes:

1. The assignment is an individual project, to be finished on one’s own effort.

2. The work must be submitted before 6pm Nov. 14, 2022 (Monday), Beijing Time. This is a firm deadline. No late submissions are accepted.

3. Plagiarism is strictly forbidden, regardless of the role in the process. Notably, ten consecutive lines of identical codes are treated as plagiarism. Depending on the seriousness of the plagiarism, 30%-100% marks will be deducted.

4. Each student is only permitted to submit code to OJ up to three times. Only the last submission will be used in evaluation of assignment marks.

Marking Criterion:

1. The full score of the assignment is 100 marks.

2. There are two java programs to be submitted. Each program has 50 marks and ten test cases. A submission obtains the full 100 marks if and only if all programs pass all the test cases of the two programs.

Running Environment:

1. The submissions will be evaluated in the course’s OJ system running Java SE version 17 and Linux platform.

2. The submission is only allowed to import four packages of (java.lang.*; java.util.*; java.math.*; java.io.*) included in Java SDK. No other packages are allowed.

3. All students will have an opportunity to test their programs in the OJ platform prior to the official submission.

Submission Guidelines:

1. Inconsistency with or violation from the guideline leads to marks deduction.

2. It is the students’ responsibility to read this assignment document and submission guidelines carefully and in detail. No argument will be accepted on issues that have been specified clearly in these documents.

Program One:

Write a java program named “MatrixMultiplication.java” to calculate the product of two matrices of sizes and respectively. Each element of the input matrices is an integer. Therefore, the result matrix is an matrix with integer elements.

An example of console input

Expected console output

3 5 7

51 61 -2 66 66

61 33 25 -14 19

-17 -20 66 67 50

-3 23 28 25 31 12 14

11 -8 27 -8 25 9 12

36 32 10 4 6 28 22

30 37 23 -8 38 30 25

38 24 -1 -5 -8 -1 28

3 7

4934 4647 4507 -79 5074 3019 4900

1382 1877 2508 1378 2182 1290 1982

6117 5560 1135 -787 1515 3424 4049

Note:

1. The first line of the input is the size of the two input matrices. In this example, , each separated by a space. The following lines give the elements of the first matrix, and each line has space-separated numbers, which form the first input matrix. Then the following lines give the elements of the second matrix, and each line has numbers, which form the second input matrix.

2. The first line of the output is the size of the result matrix, i.e., and separated by a space. The following lines, each line having space-separated integers, give the elements of the result matrix.

3. The definition of matrix and matrix multiplication operation can be found in any linear algebra textbook, or from the following link: https://en.wikipedia.org/wiki/Matrix_multiplication

4. When testing the assignment, the values of are less than .

Program Two:

Write a java program named “AsciiArt.java” to recognize the English words in ascii arts.

An example of console input

Expected console output

CHINA

CUHKSZ

JAVA

Note:

1. The first line of the console input is the number of ascii arts to be recognized. The following lines give the words in ascii arts one by one, each separated by an empty line. In this example, there are three words to be recognized, “CHINA”, “CUHKSZ” and “JAVA”. Correspondingly, the expected console output will be three lines: “CHINA”, “CUHKSZ”, “JAVA” respectively.

2. Two text files are provided for reference: “ascii_art.txt” gives the ascii art for each English letter. “sample_input.txt” gives the console input for this example.

3. In the test, the number of words to be recognized is less than 10. The maximum number of letters in each word is also less than 10.