CS2313 Computer Programming

CS2313 Computer Programming
Assignment One
Deadline: 2019-Nov-16 11:59pm
Late submission: 70% (within 24hrs after the deadline), 0% (after 24hrs)
1. Problem description
A “lucky sequence” is the sequence of numbers where every number after the first two
is the sum of the two preceding ones. And a lucky square is a two dimensional array where
all the rows or all the columns are the “lucky sequences”. In this assignment you will write
a program that will determine whether the user inputs a lucky square. The method should
be general enough to accept lucky squares of any size greater than or equal to 1.
Hints:
1. Students may assume all the numbers from the input are non-negative (no need to
check for zero or negative values) and the maximum size of the square is 10. Students
may use 2D array to store the input square, as introduced in the lecture notes for the
program. For example, one can define the input array as int square[10][10]. Then the
element at 2nd row and 3rd column of the lucky square can be stored and accessed by
square[1][2]. Note that arrays in C++ always starts from index 0.
2. The sequence of numbers in a row or col is from lower index to higher index. For
example, if the input array of size 10 is defined as int square[10][10], then the first row is
the sequence of number square[0][0], square[0][1], …, square[0][9].
3. Students may use double for loop to read in user inputs and store into arrays. Student
may use separate arrays to store the test results. Students may use one for loop to test
whether each row or column is a lucky sequence and store the result in the corresponding
代写CS2313留学生作业、代做Programming作业
arrays mentioned above. Note that the sequence is always a lucky sequence if its length
is smaller than 2. We also assume that the input size of the square is larger than 0 and
smaller or equal to 10, such that there is no need to check the range.
Submitted program will be tested repeatedly by PASS, each time with different input test
case. Note: The program only needs to read in one square. Students do not need to create
loops to handle the 2nd, 3rd square, etc. That is automatically handled by PASS.
2. Program Behavior
When running, the program first prints out the message “Please input the size of the
square:” on a single line. The program then reads the number from keyboard and prints
out another message “Please input the square row by row:”. The program then reads all
the elements of the square. The program then prints whether the rows and columns are
lucky sequences or not. If so, print “Y”. Otherwise, print “N”. Lastly, the program prints
whether the input square is a lucky square or not.
Sample Input / Output: (user input colored in blue)
Example 1 Example 2
Please input the size of the square:
3
Please input the square row by row:
2 4 6
3 5 7
6 9 15
Rows: Y N Y
Cols: N Y N
This is not a lucky square.
Please input the size of the square:
4
Please input the square row by row:
8 12 20 32
5 3 8 11
13 15 28 43
18 1 19 20
Rows: Y Y Y Y
Cols: Y N N N
This is a lucky square.
3. Mark Distribution
Correctness (6 marks)
Submitted program will be tested repeatedly with PASS. Correctness marks will be
graded objectively based on the number of correct outputs reported by PASS.
? If the program cannot be compiled, correctness mark will be zero.
? Make sure that the output format, spelling, spacing, etc., follows exactly the
sample output above. Otherwise PASS may report a very low correct count (or
even zero!). Note that the marker will make NO manual attempt to check or remark
program output.
? Unlike lab exercises, for assignment, PASS will NOT make ALL test cases visible
online, i.e. there are hidden test cases. You should not assume that the report
generated from the “Test” button is your final result.
Good Programming Practice (2 marks)
A maximum of 2 marks are dedicated to good programming styles, including:
? Choice of meaningful variable names.
? Proper use of indentation.
? Meaningful comments (explaining what the code segment or function is doing),
etc.
You may refer to the lecture notes for such good programming styles.
Note that maker will not modify nor fix your submission. Therefore the following cases
may lead to extremely low (or even zero!) marks:
? Submission of non .cpp files (e.g. .exe or .zip files).
? Submission with the “test” function rather than the “submit” function.
? Input/output does not match the requirements as defined.
(e.g. incorrect spacing, incorrect spelling, letter cases or punctuations).
4. Testing and Submission
Students should submit their C++ programs to PASS before the deadline. Students may
use whatever IDE/compiler for their own development, but the source code submitted
must be able to compile in MS Visual Studio. Programs failed to compile in MS Visual
Studio will lead to zero mark. The marker will make no attempt to correct the code and
make it compilable.
It is advised that students test the programs with PASS (using the “test” function) before
final submission (with the “submit” button). Be warned that the system could be
extremely busy and may become sluggish in responding near deadline. Only .cpp files are
accepted. Do not submit .obj , .exe or any other files.
Students should name the .cpp program with their numeric Student ID (e.g.
52345678.cpp). Don’t use EID like tmchan23. It is advised that you write down your
particulars (full name, student number, lab session, and course code CS2313) in the
beginning of your source code as comments.
5. Assessment
This assignment contributes to 8% of the total course marks. This assignment achieves
the following Course ILOs:
1. Explain the structure of an object-oriented computer program;
2. Analyze, test and debug computer programs;
3. Solve a task by applying effective programming techniques, which involve
advanced skills like using recursion and dynamic data structures;
4. Design and construct well-structured programs with good programming
practices.
6. Plagiarism
It is a serious fraud to plagiarize others’ work. Students who committed plagiarism will
be handled according to the global policy of university (http://www6.cityu.edu.hk/ah/).
All suspected plagiarism cases will be reported to the disciplinary body of the University
and not being handled in the course/departmental level.
Students, who plagiarize, as well as those who willfully lent out his/her homework to
others, will receive the same punishment. Confirmed plagiarism cases will result in
disciplinary action, including but not limited to zero marks in coursework.
How to prevent plagiarism?
You can talk about the ideas on how you would do the assignment (at language /
diagram level, but not at source code level). You need to write the program yourself.
Modifying others’ source code (e.g. block rearrangement / variable renaming / merge
source code from multiple classmate, etc,) is also considered as plagiarism.
Protect your code. Do no give away as a reference copy. Your classmate may promise
you that they will only read but not copy your code; however, if later it is observed that
both sources exhibit high level of similarity, you will ALSO be accused of plagiarism for
sure.
How do I get help for programming problems?
There are several ways you can get help:
1. Attend all the lectures and labs.
2. Post your questions (not source code!) to the discussion board in blackboard.
3. Talk to one of the student helpers.
4. Make appointment with your course instructor to discuss your problem.
Note: Debugging, fixing programming errors, is a key activity in this assignment, as
stated in the course ILO #2. Therefore, instructors and student helpers will NOT help
you fix your programming errors. Instead, they will give you high level hints about
finding programming errors, tackling your problems, and directing you to useful
resources such as code examples discussed in lectures and labs.

因为专业,所以值得信赖。如有需要,请加QQ:99515681 或 微信:codehelp

原文地址:https://www.cnblogs.com/momjava/p/11982142.html

时间: 2024-10-28 19:17:15

CS2313 Computer Programming的相关文章

K老在拿图灵奖时的发言:Computer Programming as an Art

很多话说得很透彻,把一些觉比较精彩的摘抄一下.... It seems to me that if the authors I studied were writing today, they would agree with the following characterization: Science is knowledge which we understand so well that we can teach it to a computer; and if we don't ful

CCN2042 Computer Programming

CCN2042 Computer ProgrammingGroup Project – Cooking Game(Due: 23:59, 18 Apr 2019 (week 12 before Easter))Expected Learning Outcomes familiarise themselves with at least one high level language programming environment. develop a structured and documen

MTH5001: Introduction to Computer Programming

projectMarch 14, 20191 MTH5001: Introduction to Computer Programming 2018/191.1 Final Report Project: "Networks"1.1.1 Instructions:First, please type your name and student number into the Markdown cell below:Name:Student number:You must write yo

ISOM 3029 - Computer Programming Using C++

University of MacauFaculty Of Business AdministrationISOM 3029 - Computer Programming Using C++ 2019/2020 (First Semester)Assignment 1Due date: October 11, 2019 (before 5pm)Submitted to: Ms YunYun Zhou (GA) Instructions:?Read the Assignment Requireme

Reflection (computer programming) -反射

n computer science, reflection is the ability of a computer program to examine, introspect, and modify its own structure and behavior at runtime.[1] A language supporting reflection provides a number of features available at runtime that would otherw

Teach Yourself Programming in Ten Years

Teach Yourself Programming in Ten Years Peter Norvig Why is everyone in such a rush? Walk into any bookstore, and you'll see how to Teach Yourself Java in 24 Hours alongside endless variations offering to teach C, SQL, Ruby, Algorithms, and so on in

Important Programming Concepts (Even on Embedded Systems) Part V: State Machines

Earlier articles in this series: Part I: Idempotence Part II: Immutability Part III: Volatility Part IV: Singletons Oh, hell, this article just had to be about state machines, didn’t it? State machines! Those damned little circles and arrows and q’s.

glob (programming) and spool (/var/spool)

http://en.wikipedia.org/wiki/Glob_(programming) In computer programming, in particular in a Unix-like environment, the term globbing is sometimes used to refer to pattern matching based on wildcard characters.[citation needed] The noun "glob" is

10 ways to improve your programming skills

http://rudyn.is-programmer.com/ 1. Learn a newprogramming language学习一门新的编程语言 Learning new programming languages will expose you to new ways ofthinking; especially if the new language uses a paradigm which you aren't yetfamiliar with. Many of the ways