联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> C/C++编程C/C++编程

日期:2019-04-24 10:54

2019 Spring CSCI3150 – Bonus1

Deadline: April 25, 2019 11:00AM

Contents

1 Introduction 3

1.1 The database file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

1.2 Example usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2 Your assignment 8

2.1 Git Classroom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.2 The assignment package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.3 Remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.3.1 run.sh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.3.2 grader.sh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

2.3.3 Run it locally . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

2.4 To begin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

2.5 Your job . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

2.6 Submitting your assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

3 Grading 10

4 Change Log 10

1

5 Questions 11

6 Academic Honesty 11

7 General Notes 11

2

1 Introduction

In this assignment, you are going to write shell scripts to simulate a course registration

system. We assume that this system stores the registration records in a CSV file. Figure 1

shows a sample file:

Figure 1: The sample database file.

The main shell script is run.sh. The syntax for running it is:

./run.sh [operation type] [input parameter]

The 4 possible operations are as follows, and the “input parameter” is the information

corresponds to the chosen operation:

operation type Operation

1 List all the courses a given student registered.

2 List the total numbers of students who registered a given set of

courses.

3 Insert a registration record.

4 Delete a registration record.

1.1 The database file

It is in .csv format, with “,” as the delimiter. It has four fields and no space between.

Field Format

Student ID 10 digits

Name One word without space

Course ID 4 characters followed by 4-digits (no space).

Course Name A string

3

1.2 Example usage

Assume that the current database file is as Figure 1.

Operation 1. List all the courses a given student registered

./run.sh 1 [Student ID]

Examples:

Input1 ./run.sh 1 1155073100

Output1

Introduction to Operating Systems

Introduction to Database Systems

Input2 ./run.sh 1 2255073100

Output2

Notes and Assumptions:

1. Output: Each course name is in a separated line without any leading or trailing whitespace.

2. Output: The course names should follow the order as in the database file, i.e,

the system should first output “Introduction to Operating Systems” and then output

“Introduction to Database Systems”.

3. Output: If a student id is not found, output empty (output nothing).

4. The input format is always correct (it contains ten digits), but it is not necessary for

an input student ID exists in the database file.

Operation 2. List the total numbers of students who registered a given set of

courses.

./run.sh 2 [CourseID1 CourseID2 ...]

Examples:

4

Input ./run.sh 2 CSCI3150 CSCI4190 CSCI1100

Notes and Assumptions:

1. Output: Output 0 if a particular course ID doesn’t exist.

2. Output: Output each number in a single line without any leading and trailing whitespace.

3. Output: each output line corresponds to the total number of students who register the

given course, which are CSCI3150, CSCI4190 and CSCI1100, respectively. Because the

course CSCI1100 does not appear in the database file, the last output line is 0. The

output order shall follow the input order of the course IDs.

4. We always input at least one course ID.

5. The course ID format is always correct.

Operation 3. Insert a registration record

./run.sh 3 [StudentID Name CourseID ‘‘CourseName’’]

Examples:

Input ./run.sh 3 1155073104 Jim CSCI4190 “Introduction To Social Networks”

Output

The total number of records is:

7

Notes and Assumptions:

1. Output: 2 lines – the 1st line is the description “The total number of records is:” and

the 2nd line is the total number of records after the insertion.

5

Figure 2: The database file after the insert operation.

2. We insert one record in each operation.

3. The grammar is correct, i.e., the input record always includes the correct format.

4. The inserted record has not been existed in the database file yet.

5. The four fields are separated by spaces ( ). Use double quotes(“”) to quote the CourseName

string.

6. The inserted record should be appended as the last line of the database file.

7. The database file after this example operation is shown in Figure 2.

Operation 4. Delete a registration record

./run.sh 4 [StudentID CourseID]

or

./run.sh 4 [CourseID StudentID]

Examples:

Input1 ./run.sh 4 1155073100 CSCI3150

Output1

The total number of records is:

6

Input2 ./run.sh 4 CSCI3170 1155073102

Output1

The total number of records is:

5

6

Figure 3: The sample database file after the delete operation with input1.

Figure 4: The sample database file after the delete operation with input2.

Notes and Assumptions:

1. Output: 2 lines – the 1st line is the description “The total number of records is:” and

the 2nd line is the total number of records left after the deletion.

2. The course id and the student id must be interchangeable.

3. We delete one record in each operation.

4. The grammar is correct, i.e., the input format is correct.

5. The deleted record is always in the database file.

6. You might need to remove empty lines in your database file, if any.

7. If the original database file is Figure 2, then after input1, the database file should be

Figure 3. And similarly, the database file should be Figure 4 after input2.

7

2 Your assignment

2.1 Git Classroom

You should have opened a GitHub account and let us know your GitHub account and your

student ID in previous assignment . So, after logging in your Github account, come here

https://classroom.github.com/a/M_wr4nTf to get a new repo for this assignment. The

new repo should contain the starter package for this assignment.

Warning: DON’T change the names. Otherwise, you will get 0 marks.

2.2 The assignment package

Follow the steps in section 2, you can get a local copy of the repo to your desired directory.

You are given the following files:

Name Description

/run.sh The main script (Don’t touch).

/listDatabase.sh Script to print the database file when automatically

grading (Don’t touch).

/listCourses.sh Script to achieve Operation 1 (Work on it)

/listNumbers.sh Script to achieve Operation 2 (Work on it)

/insert.sh Script to achieve Operation 3 (Work on it)

/delete.sh Script to achieve Operation 4 (Work on it)

/testcases/data/ Test data.

/testcases/expected/ Expected output

/grader.sh You can run this script to check your results

(Don’t touch)

2.3 Remarks

2.3.1 run.sh

The main script. Given to step you through the exercise. Don’t modify this file.

8

1. It parses the operation type and invokes the corresponding shell file based on the

operation type chosen by the user.

2. It also passes the arguments to your functions.

3. It saves the database file path into the ENV variable $DATABASE.

4. There is a call to “listDatabase” operation for operation types 3 and 4. Ignore them

— that is solely for auto-grading purpose.

2.3.2 grader.sh

It contains 10 test cases and it will match your output with our expected output.

2.3.3 Run it locally

You are encouraged to work on our VM on a newly created local directory. If you have not

gotten the VM, please follow the steps in Lab 1 to setup the VM on your own computer.

Especially, if you transfer the files from your host to your VM through a shared folder, don’t

work on the shared folder directly because it may cause some permission access problems.

2.4 To begin

To avoid any permission problem, you need to make sure all files are editable. Instead of

changing the access permission of all files one by one, you can go to the parent folder (e.g.

csci3150-bonus1-Jim) that contains your assignment and execute the command chmod -R 777

csci3150-bonus1-Jim, which changes the access permissions to all files in csci3150-bonus1-

Jim. After you have finished the scripts, run grader.sh to check whether you can pass the

given test cases, you shall see something like this:

9

For each failing test case, grader.sh prints your output on the left against our expected

output on the right. At the end, it prints the total number of test cases passed.

2.5 Your job

Your job is to fill up the contents for listCourses.sh, listNumbers.sh,insert.sh and

delete.sh in order to pass all given test cases and let the grader print the following:

2.6 Submitting your assignment

Follow the same procedure in assignment 0.

3 Grading

1. The TA will fetch and grade your latest version in your repo as of April 25, 2019

11:00AM. Remember to commit and push before the deadline!

2. 10 test cases in total, which are testcase1 to testcase10 as listed in grader.sh.

3. Passing one test case will earn you 10 marks.

4. Your script shall output results to standard output stream but not to any file. Otherwise,

you will get 0 mark.

5. Your script shall NOT write any intermediate result to file. Otherwise, you will get 0

mark.

4 Change Log

1.0 this document

10

5 Questions

If you have doubts about the assignment, you are encouraged to ask questions on Piazza

using the corresponding tag. Please focus on knowledge. Unhealthy questions/comments

that focus on scores and grades are not encouraged.

If you find any (possible) bugs, send private questions on Piazza to us instead

— otherwise that may cause unnecessary panic among the class if that is not a real bug.

6 Academic Honesty

We follow the University guide on academic honesty against any plagiarism.

7 General Notes

This specification and our grading platform are both based our given course VM. You

should compile, debug and run the assignment program on that VM. So, if you insist

to develop on another platform other than our VM and got any question, test it on

our VM before you ask.

The TA reserves the right to adjust your scores for any request that requires their extra

manual effort.

Unless specified, you should work and fill your code in designated areas. There are

cases that the modification outside the designated area leads to misbehavior of the auto

grader. Proceed with caution and look back the changes if your output is different from

what is shown in the grader.

While we have already tried our best to prepare this assignment, we reserve all the

rights to update the specification and the grading scheme. If there are any mistakes/bugs

which are on ours, the TA will step in and do manual grading to ensure

you get what you deserve. Please respect each other. Any irresponsible, unfair, biased

sentiment would regard as a disciplinary case.

11

If this is a programming assignment, only C is allowed, not even C++. If this is a

scripting assignment, only bash shell script is allowed, not even Python. Furthermore,

for C programming assignments, use the “exit” function parsimoniously because it

might influence the grader as well. Therefore, use “return” instead of “exit” whenever

possible.

Although this is not an algorithm class, you still shouldn’t implement your assignment

with very poor complexity. While the TAs will try their best to run your program

as long as they could, they reserve the right to terminate a test case and regard that

as a failed test case when a program takes unreasonably long time to finish (try to

compare your running time with the TA’s demo if it is given), or until when the TAs

can’t run any longer due to the deadline the TA needs to submit your final scores to

the department.

When grading, the TAs will execute the grader program to run the whole test suite

(which consists of all test cases). The TAs won’t grade each individual test case

separately.

(Frequently Asked) [Output format] If the assignment package includes a demo,

then our grader defines test cases based on the given demo. In that case, your output

shall exactly follow that demo. For example, hypothetically, if our demo outputs a

message like:

command not found

with two spaces between “not” and “found”. Your output shall also match that in

order to pass the test. The good news is that, if our given demo has not implemented

something (e.g., missed certain error checking), you also don’t need to do so. No

test cases would be defined based on something that our demo has not

implemented.

(Frequently Asked) [Scope of error handling] The scope of error checking and

handling shall refer to both our given demo (if given) and our given test cases.

First, the corresponding output message shall exactly follow our demo. Second, you

12

are informed that our demo may have implemented more error checking that what our

grader will test. In that case, it is fine that you implement only the error checking that

is tested by our grader. So, one top tip is:

CHECK THE (SOURCE OF)

TEST CASES BEFORE YOU ASK

(Frequently Asked) [No hidden test case] We are not intended to run any secret/extra

test cases that deliberately break your assignment. That is, WYSIWYG —

your final score shall be generally indicated by what the grader reports when it runs

on the course VM. However, we do reserve the right to run some additional test cases

to avoid any mis-conduct (e.g., hard-coding the results), and/or invite you to explain

the source code to the teaching assistants and adjust the scores accordingly.

We welcome discussions among classmates. But don’t share your assignment with the

others in any means. For example, don’t put your source code in any public venue (e.g,

public repo, your homepage, Facebook). We handle plagiarism strictly. On submitting

this assignment, you are agreed that your code’s copyright belongs to the Chinese

University of Hong Kong. Unless with our written approval, you must not release

your source code and this specification now and forever. If you share your code with

anyone without our written consent, that would regard as a disciplinary case as long

as you are still a CUHK student (i.e., even after this course). If you share your code

with anyone without our written consent after your graduation, that would regard as

a breach of copyright and we reserve all the rights to take the corresponding legal

actions.

Google is your friend. We encourage you use Google for help to do the assignment.

However, if you happen to find any source codes related to this assignment, you still

cannot copy it but use your own way to implement it. You need to put down your list

of source code references as comments in the top of your source code.

13

(Frequently Asked) [Late Policy] TAs will only grade the latest version submitted

before the deadline, no late submission is allowed. It is your responsibility to make

sure you added, committed, and pushed the final version before the deadline. You are

required to check whether your final version is really in Github Classroom.

14


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp