[SOLVED] CS计算机代考程序代写 c# c++ Instructions

30 $

File Name: CS计算机代考程序代写_c#_c++_Instructions.zip
File Size: 461.58 KB

SKU: 7288801215 Category: Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Or Upload Your Assignment Here:


Instructions
CS2311 Computer Programming Assignment One
10% of Total Marks
Released on 27 Jan 2021
Due on 3 Mar 2021 23:00
1. Complete ALL five questions in this assignment.
2. Write all your programs in Visual Studio Enterprise 2019 for C++. Programs not compliable
by Visual Studio Enterprise 2019 for C++ will receive no mark.
3. Late submissions will have penalty. Late by every 24 hours will have 20% of the total marks of the assignment deducted. (E.g., if you receive 80 marks and late by 2 days, your mark will be 40.) The best advice is to submit your solutions on hand.
4. All solutions will be assessed by (1) correctness, (2) programming styles (including comments), and (3) non-redundancy in expressing solutions, if applicable.
5. All inquiries and clarification questions should be sent to the TAs of the course.
Solution Submission Instruction
• Name your folder as your student number, and create a sub-folder for your solution for each question. Name your solution using your student number followed by the question number. E.g., 5xxxxxxx_Q1.cpp, 5xxxxxxx_Q2.cpp, 5xxxxxxx_Q3.cpp, etc.
• Zip the whole folder into one ZIP file, and name it as your student with a .zip extension.
o Forinstance,ifyourstudentnumberis51234567,createafolder51234567.
Create subfolder Q1, Q2, …, Q10 under the folder 51234567. Place the .cpp file of your C++ solution for Q1 under the folder Q1, place the .cpp file of your C++ solution for Q2 under the folder Q2, and so on.
o Zipyourfolder51234567intoaZIPfilenamedas51234567.zip.
Academic Honestly
The course will follow the University academic honesty statement. It will use multiple code plagiarism detection software to check every solution the whole class submits. Students are suggested to keep important intermediate versions and paper draft of their solutions in case that students are asked to show evidence of self-effort and originality in developing their solutions of each question.
Question
Mark
TA responsible
Q1. Program skeleton
10%
Imran Ashraf
[email protected]
Q2. Iteration and selection
20%
Alan Nguyen
[email protected]
Q3. Output control
20%
Jankin Wei
[email protected]
Q4. Application to letter decoding
30%
Haipeng Wang
[email protected]
Q5. Segment counting
20%
Andrew Zhu
[email protected]

1.
[10%] Write a program to fulfill all of the following requirements:
• It does not accept any input.
• It uses the 8 digits of your student number to initialize 8 variables of type int, one for each variable.
• It prints 10 lines such that each line displays an expression that only uses these 8 variables (without the use of any constants) and the following four operators (i.e., +, -, *, %) to compute a single-digit result (i.e., 0, 1, 2, 3, 4, 5, 6, 7, 8, 9) followed by the equal sign (=) and the single-digit value thus computed. Each of your expression in your program may use the same variables as many times as you like and/or the same operators as many times as you like. Note that the divide-operator (i.e., /) is not allowed to be used.
• It prints these 10 lines so that a line with smaller single-digit result is printed before a line with larger single-digit result i.e., the resulting single-digits in each line (the numbers on the right side of the equal sign ‘=’) should be in an ascending order from 0 to 9.
Two samples are listed below:
Sample 1
Sample 2
Code
/* Define the 8 variables as follow in this program. */
/* For example, my Student Number is 50769206, the following 8 statements are included in this program. */
int s1 = 5; int s2 = 0; int s3 = 7; int s4 = 6; int s5 = 9; int s6 = 2; int s7 = 0; int s8 = 6;
/* For example, my Student Number
is 53534460, the following 8
statements are included in this
program. */
int s1 = 5; int s2 = 3; int s3 = 5; int s4 = 3; int s5 = 4; int s6 = 4; int s7 = 6; int s8 = 0;
Console Output
My student number = 50769206
The result:
s2 = 0
s3 – s4 = 1
s6 = 2
s5 – s4 = 3
s4 – s6 = 4
s1 = 5
s4 = 6
s3 = 7
s6 + s8 = 8
s5 = 9
My student number = 53534460
The result:
s8 = 0
s5 – s4 = 1
s1 – s2 = 2
s4 = 3
s5 = 4
s3 = 5
s7 = 6
s4 + s5 = 7
s5 + s6 = 8
s2 + s7 = 9

2. [20%] Write a program to print different stages of the hangman figure based on the user input.
• If a user provides a letter within the range of lowercase letter a-z, and the program will print the corresponding stage of the hangman figure in the Console window, and this
process of asking for input and print hangman stage repeats.
• If the program prints two hangman figures, they should be separated by some empty lines
as illustrated in the sample output below.
• If the user provides the letter @, the program prints Bye bye! and then end-of-line
character. After that, the program ends.
• Your program can assume that the user always provides a valid input.
• Under the hangman figure, print your full student name after printing the text By: and a
blank space such that all these texts (from By: to the end of your student name) should be placed exactly right under the stage (=============) of each hangman figure. Make the length of the stage same as the length of your student name as illustrated by the examples below.
• [hint: your program should use a variable of char datatype to receive user inputs.]
User input range
Stage of Hangman Figure
a-d
+—-+ || |
|
|
|
=============
e-k
+—-+ || |O || |
|
=============
l-q
+—-+ || |O | /| |
|
=============
User input range
Stage of Hangman Figure
r-u
+—-+ || |O | /| |
|
============
v-x
+—-+ || |O | /| | |
============
y-z
+—-+ || |O
| /| |/ |Game Over
============
Sample
Console Input and Output. Input is underlined.
Choose the hangman
+—-+ || |
|
|
|
================
By: CHAN Tai Man
Choose the hangman
+—-+ || |
|
|
|
================
stage [a-z, @ to end the program]: a
stage [a-z, @ to end the program]: b

By: CHAN Tai Man
Choose the hangman
+—-+ || |O || |
|
================
By: CHAN Tai Man
Choose the hangman
+—-+ || |O | /| |
|
================
By: CHAN Tai Man
stage [a-z, @ to end the program]: f
stage [a-z, @ to end the program]: p
stage [a-z, @ to end the program]: t
stage [a-z, @ to end the program]: x
stage [a-z, @ to end the program]: y
stage [a-z, @ to end the program]: @
Choose the
+—-+ || |O | /| |
|
================
By: CHAN Tai Man
hangman
Choose the
+—-+ || |O | /| | |
================
By: CHAN Tai Man
hangman
Choose the
hangman
+—-+ || |O
| /| |/ |Game Over
================
By: CHAN Tai Man
Choose the hangman
Bye bye!

3. [20%] Write a program to meet all the following requirements:
• Input (1) the size of an equilateral triangle to print and (2) a parameter filled of the char datatype.
o filled is to indicate whether the triangle is a filled triangle or not (i.e., a hollow triangle).
o size represents the number of lines of the whole triangle to be printed.
• If the triangle is a filled one, the number of asterisks (*) in each line equals to its line number. For example, the third line should contain three asterisks. If it is not a filled one, the triangle should only print the border of a filled triangle, i.e., all the inner
asterisks should not be printed.
Inputs are underlined.
Sample 1
Please input the size of the triangle: 5 Is the triangle filled?: Y
* ** ** * *** * **** *
Sample 2
Please input the size of the triangle: 5 Is the triangle filled?: N
* ** ** ** **** *
Sample 3
Please input the size of the triangle: 13 Is the triangle filled?: N
*
**
**
** ** ** ** ** ** ** ** ** * * * * ** * * * * * * *

4.
[30%] Keypad translation
The diagram below shows the layout of a mobile phone keypad. Each letter in the alphabet corresponds to a unique sequence of keystrokes. For example, the keystroke sequence 2 gives the letter ‘a’, 22 gives the letter ‘b’, and 222 gives the letter ‘c’. To write “HI THERE”, the sequence of keystrokes is 44144408443377733, where 1 means a pause, and 0 represents a space. The two keys * and # will give the letters ‘*’ and ‘#’, respectively.
Note that sometimes a user would like to output consecutive characters which make use of the same key. E.g., to output the message “HI”, the procedure is as follow: the user should first press the key 4 twice then the key 1 once to indicate that there is a pause to output the character ‘H’ for the “44”. Then, the user should press the key 4 thrice to output the character ‘I’. So, to output the message of “HI”, the user should enter 441444 in the phone keypad.
Assume that the input message will not start with 0 and the length of the input message always consists of 17 digits. Write a program to read a sequence of non-empty keystrokes and output the translated message and the number of characters typed. Note that the “space” should be counted as a character in the output. Sample inputs and outputs are given below.
Input is underlined.
Sample 1
Please enter the message: 44144408443377733 HI THERE
Count: 7
Sample 2
Please enter the message: 22244489998804455 CITYU HK
Count: 7

Sample 3: This case has a space as the last character
Please enter the message: ##777717771771011 ##SRQ
Count: 5
Sample 4
Please enter the message: 22222122#2202221# BB#B C#
Count: 6
Sample 5
Please enter the message: 33333333333333333 E
Count: 1
Sample 6
Please enter the message: 806199992*2#33444 T MZA*A#EI
Count: 9
Sample 7
Please enter the message: 806199992*2#33441 T MZA*A#EH
Count: 9

5. [20%] [Counting Up and Down Segments]
Given a sequence of positive numbers, we can know whether the values of these numbers becomes larger and larger (including the same value), or smaller and smaller (including the same value), or change the direction. For instance, given the sequence 1, 2, 3, 3, we know that the sequence goes up or stay unchanged without changing the direction (that is, we count that there is 1 up-segment); given the sequence 8, 4, 2, 1, 0, we know the sequence goes down without changing the direction (that is, there is 1 down-segment); and given the sequence 3, 44, 0, 34, 3, 4, 5, 31, 40, we can find out that 3->44 goes up, then 44->0 goes down, and then 0->34 goes up, and then 34->3 goes down, and finally 3->4->5->31->40 goes up. So, for these three exemplified sequences, there are 1 up- segment, 1 down-segment, and 3 up-segments plus 2 down-segments, respectively.
Write a program to accept a sequence of positive number ended with the value of -1, and the program will output the total number of up-segments and total number of down-segments in the inputted sequence of positive numbers.
Sample 1
Input a sequence of numbers (ended with -1):
-1
No. of Up Movement is: 0 No. of Down Movement is: 0
Sample 2
Input a sequence of numbers (ended with -1):
1 2 3 4 3 2 1 -1
No. of Up Movement is: 1 No. of Down Movement is: 1
Sample 3
Input a sequence of numbers (ended with -1):
3 4 4 2 9 6 8 4 -1
No. of Up Movement is: 3 No. of Down Movement is: 3
Sample 4
Input a sequence of numbers (ended with -1):
1 3 4 6 8 0 9 7 6 5 4 3 27 8 9 0 6 5 4 3 2 0 8 7 6 5 4 3 6 6 6 4 3 2 3 4 -1
No. of Up Movement is: 8 No. of Down Movement is: 7
Sample 5
Input a sequence of numbers (ended with -1):
1 1 1 4 4 4 -1
No. of Up Movement is: 1 No. of Down Movement is: 0
– End –

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] CS计算机代考程序代写 c# c++ Instructions
30 $