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. 8, 2024 (Friday), 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.
Marking Criterion:
1. The maximum score a student could obtain in this assignment is 100 marks (i.e. more than 100 marks will be counted as 100 marks).
2. Two java programs are to be submitted. Each program will be evaluated with several unseen test cases. A submission obtains the full score if and only if both programs pass all test cases.
Running Environment:
1. The submissions will be evaluated in the OJ system running Java SDK. It is the students’ responsibility to make sure that his/her submissions are compatible with the OJ system.
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. The score is based on your submission on OJ, but you also need to submit your code (that is, directly submit the screenshots, MatrixMultiplication.java and AsciiArt.java) on blackboard. Otherwise, you will get 0 for this assignment.
2. Inconsistency with or violation from the guideline leads to marks deduction.
3. All students are reminded to read this assignment document carefully and in detail. No
argument will be accepted on issues that have been specified in this document.
Exercise One (15 marks):
Finish the three problems (https://oj.cuhk.edu.cn/d/csc1003_2024_fall/p) from P1010 to P1012 online, and upload screenshot(s) to show that you finished the exercise. You can earn 15 marks without requiring “AC” by attempting to complete 3 questions.
Exercise Two (50 marks):
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
357
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
37
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, 𝑚 = 3, 𝑛 =
5, 𝑝 = 7, each separated by a space. The following 𝑚 lines give the elements of the first matrix,andeachlinehas 𝑛 space-separatednumbers,whichformthefirstinputmatrix.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. Thefollowing 𝑚 lines,eachlinehaving 𝑝 space-separatedintegers,givetheelementsofthe 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. 𝑚, 𝑛, 𝑝 ≤ 100, |𝑒𝑙𝑒𝑚𝑒𝑛𝑡𝑠| ≤ 100.
Exercise Three (50 marks):
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 art words 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.
版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。