Starting from:

$25

CSC3002: Introduction to Computer Science Assignment 1 Solution

Assignment description:

You should write your code for each question in several .cpp and .h file (please name it using the question name, e.g. q1.cpp). Please pack your whole project into a single .zip file, name it using your student ID (e.g. if your student ID is 123456, then the file should be named as 123456.zip), and then submit the .zip file via BB.

 

For this assignment, you don’t have to use the sample project. You can create an empty project with QT Creater to start programming.

 

Please note that, the teaching assistant may ask you to explain the meaning of your program, to ensure that the codes are indeed written by yourself. Please also note that we may check whether your program is too similar to your fellow students’ code using BB.

 

Please refer to the BB system for the assignment deadline. For each day of late submission, you will obtain late penalty in the assignment marks. If you submit more than three days later than the deadline, you will receive zero in this assignment.

 

Detailed description on assignment requirement is stated in the last few pages.

 

Question 1:

 

 

 

 

 

 

 

 

 

 

 

 
 
 
Question 2

Question Requirement
 

Q1:

You should write four files: calendar.h, calendar.cpp , p1.h and p1.cpp.

 

Of them,

 

h should include the declaration of the Month type, the functions daysInMonth and isLeapYear.
cpp should contains the implementation of the two functions in calendar.h.
h should at least (You can write other functions to simplify your program) include the declaration of functions void p1().
cpp should include implementations for functions declared in p1.h, the test method void p1(), which is able to ask the user to input a year and then print the number of days in each month of the year.
 

The sample output should be:

Q2:

You should write two files: p2.h and p2.cpp.

 

Of them,

h should at least (You can write other functions to simplify your program) include declaration of the two functions shown below.
 

void p2();

 

cpp should include implementations for functions declared in p2.h. Of them, p2() is the test method which contains the test program.
 

The test method void p2(), should be able to ask user to input from console to specify the DNA strand to be attached to and a shorter one. Then it output all the positions after matching.

 

A sample output should be:

$Please input the longer DNA strand:TAACGGTACGTC $Please input the shorter one:TGC $The matching positions should be: 2, 7

 

 

 

Assignment Submission
 

Please put all required files in a single QT project which is stated in the first line of each Question Requirement Write a main.cpp file which includes a main function to invoke different questions as follows:

 

The project layout:

 

After you test all your questions, zip the whole project in one file named XXX.zip (XXX is your student ID and your name is not required) and then submit it to the BlackBorad (BB) system.

 

 

 

Marking scheme
 

For each question:

 

20% Marks will be given to students who have submitted the program on time.
20% Marks will be given to students who wrote the program that meet all the requirements of the questions.
20% Marks will be given to students who programs that can be compiled without errors and warnings
20% Marks will be given to students whose programs produce the correct output if their programs can be compiled.
20% Marks will be given to students who demonstrate good programming habit and style.
 

 

 

 

 

 

 

 

 

 

 

Q&A
How to check whether the assignment is submitted on time?
 

We directly check it through BB system

 

How to check whether the assignment meets the requirement?
 

A zip file containing the whole project is submitted
Zip filename is valid (studentID.zip)
All the required files stated in Each Question Requirement should be included with correct name.
The main.cpp with correct content should be included.
The content of each file should satisfy the requirement. For example, the declaration of p1() should be in p1.h and its implementation should be in p1.cpp.
No other additional files are included
 

How to check whether the assignment can be compiled?
 

Note that we strongly suggest you to use the QT IDE since your code tested on other IDE may not work on QT. If you want to use other IDE, please test your code again on QT to avoid such errors.

 

If the QT IDE generates any errors when building your project, 20% mark will be missed for each question. If any warnings are produced but your code can run, 20% mark will be missed for all  questions.

 

How to check the assignment gives correct output?
 

We will run your code if it can be compiled (warnings are tolerated). You test code should be correct and output is also correct. User-friendly test code and output is preferred.

 

How to check the programming style? ⚫
You should include three kinds of comments in your code:

File comments in the beginning of each code file,
for example,

Function comments just before each function implementation. For example,
Statement comments on the right side of some statements if necessary. You do not have to write comments for each statement.
 

⚫ Code layout.

 

Beautiful !!!!

 

The following points should be pay attention to: a. The indentation used

{} used for function, for structure, while structure, switch structure.
meaningful variable name.
 

We strongly suggest you to adhere to the coding style used in our textbook, which will be followed by us to check your code.

 

More products