Starting from:
$35

$29

Project Phase 1

Aim:    1. Create your own standalone C program using Code::Blocks.
    2. Practise using variables, expressions, branching and looping statements.
    3. Work with simple console user input/ output interactively.

Background:

This project is about creating an information system for managing course registration. In this phase, we shall set up a single-user, interactive, text-based and menu-driven application for course selection. In this exercise, we only allow selecting at most three ENGG courses in the shopping cart.


Requirements:

Design and implement the application in C. Firstly, create a new Code::Blocks Console application C project Phase1. Then, work on the newly created C program source file main.c. Insert a header comment block showing your name, SID, declaration on academic honesty, etc., i.e., similar to those submitted in your lab exercises. Make sure you have this header file inclusion line:


#include <stdio.h>    // standard i/o header file

The program shall perform the following tasks to interact with the user and we shall assume user inputs are always integers, unless specified otherwise. User will never input alphabets or other non-numeric symbols. Each input number is followed by Enter.

    a) Display a banner message.

    b) Ask for SID in the form of 1166xxxxxx, i.e., a 10-digit integer with the prefix 1166. If the input integer does not conform, show an ERROR message and ask for SID again.

    c) Ask for expected GPA in the range of 1.0 – 4.0 inclusively. If the input number is out of range, show an ERROR message and ask for it again. User may input a double-type floating-point number here.

    d) Initially, set up an empty course shopping cart with three nil slots.

    e) Display the current shopping cart as well as a menu consisting of four choices:

        1. Add a course

        2. Drop a course

        3. Clear shopping cart

        4. Check out



Copyright © 2017-18 CSE, CUHK, designed by Michael Ping-Fu, FUNG    Page 1 of 5
Ask for an action code 1 – 4. If the input is out of range, show an ERROR message and repeat Step e).


    f) Action 1. Add a course.

        1. If the shopping cart is full, show an ERROR message and go back to Step e).

        2. Ask for a course code in 1000 – 9999 inclusively. If the input is out of range, show an ERROR message and ask for the course code again.

        3. Check if the shopping cart has the course code to be added. If it is there already, show an ERROR message and go back to Step e).

        4. Keep the newly added course in the last available (nil) slot in the shopping cart.

        5. Go back to Step e).


    g) Action 2. Drop a course.

        1. If the shopping cart is empty, show an ERROR message and go back to Step e).

        2. Ask for a course code in 1000 – 9999 inclusively. If the input is out of range, show an ERROR message and ask for the course code again.

        3. Check if the shopping cart has the course code to be dropped. If it is not there, show an ERROR message and go back to Step e).

        4. Remove the dropped course code from the shopping cart. Re-pack the shopping cart by moving up non-nil slot(s) sequentially.

        5. Go back to Step e).


    h) Action 3. Clear shopping cart.

        1. Remove everything from the shopping cart.

        2. Go back to Step e).


    i) Action 4. Check out.

        1. Check if the shopping cart is empty. If so, show an ERROR message and go back to Step e).

        2. Display SID, a list of registered course(s), average grade target (referring to CUHK grade-to-GPA mapping) and expected GPA (with 2 decimal places).

        3. Terminate the program and finish.


    j) Sample and testing environment. A sample application for Windows is available on Blackboard. You shall download and try the sample rigorously to understand the


Copyright © 2017-18 CSE, CUHK, designed by Michael Ping-Fu, FUNG    Page 2 of 5
requirements as well as the format of the menu, shopping cart, input prompts and ERROR

messages.


Sample Run: (text in RED color indicates user input)

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Course Registration Information System
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Input your SID [in form of 1166xxxxxx]: 115501234
ERROR: Your SID is not conforming!

Input your SID [in form of 1166xxxxxx]: 1166123987
Input your expected GPA [1.0-4.0]: 0.8
ERROR: Your expected GPA is out of range!
Input your expected GPA [1.0-4.0]: 2.75
===============================================================================

1234567890123456789012345678901234567890123456789012345678901234567890123456789
You have selected 0 of 3 course(s), here is your shopping cart:
Course A): nil
Course B): nil
Course C): nil

Operation menu:
    1. Add a course
    2. Drop a course
    3. Clear shopping cart
    4. Check out
Action [1-4]:
1
==> 1. Add a course
Add course code [1000-9999]:
888888

ERROR: Invalid course code!
Add course code [1000-9999]:
1110
===============================================================================
1234567890123456789012345678901234567890123456789012345678901234567890123456789

You have selected 1 of 3 course(s), here is your shopping cart:
Course A): ENGG1110
Course B): nil
Course C): nil
Operation menu:
    1. Add a course
    2. Drop a course
    3. Clear shopping cart
    4. Check out
Action [1-4]:
2
==> 2. Drop a course

Drop course code [1000-9999]:
2222

ERROR: Course code ENGG2222 not found in your shopping cart! =============================================================================== 1234567890123456789012345678901234567890123456789012345678901234567890123456789

You have selected 1 of 3 course(s), here is your shopping cart:
Course A): ENGG1110
Course B): nil
Course C): nil
Operation menu:

    1. Add a course
    2. Drop a course
    3. Clear shopping cart
    4. Check out
Action [1-4]:


Copyright © 2017-18 CSE, CUHK, designed by Michael Ping-Fu, FUNG    Page 3 of 5
-1
ERROR: Wrong action -1
===============================================================================
1234567890123456789012345678901234567890123456789012345678901234567890123456789
You have selected 1 of 3 course(s), here is your shopping cart:
Course A): ENGG1110
Course B): nil

Course C): nil
Operation menu:
    1. Add a course
    2. Drop a course
    3. Clear shopping cart
    4. Check out
Action [1-4]:
4
==> 4. Check out
Dear student 1166123987

You have selected 1 course(s), here is your shopping cart:
Course A): ENGG1110

You shall get at least average grade B to achieve GPA of 2.75



Guidance and Submission:

    1. More sample data sets, sample outputs and test cases will be made available on Blackboard and/or codeSubmit for you to understand the requirements.

    2. Edit, Build (Compile), Run and Debug your program. If you do something wrong, don’t panic. Double-click on the first error message. Check it, correct it and retry. Remember that a single mistake may trigger dozens of error messages. Always begin tackling the first error and conquer one at a time. Be reminded that the error message itself as well as the indicated line number may not be accurate.

    3. Thoroughly Test Run your program with different input data sets such as extreme values and boundary values. You may try some of our test cases. However, you shall design your own test plan and test cases. Check and compare your program output carefully.

    4. Submit your code in main.c, i.e., copy-and-paste, to codeSubmit to test your work and to get score by running our test cases.

    5. Locate your Code::Blocks project folder Phase1\ and

Upload and Submit two files Phase1.cbp and main.c via Assignment Collection Box on https://blackboard.cuhk.edu.hk. We will examine your Code::Blocks project to assess you work on project management, coding style and/or running more tests.

Marking Scheme and Notes:

    1. The submitted program should be free of any typing mistakes, compilation errors and warnings. Please make sure your submitted work can be compiled successfully on Code::Blocks, our official platform.

    2. Your proper declaration statement, your name and SID, file naming, adequate comment, code indentation, coding style such as variable naming, etc. are under assessment in every programming assessments unless specified otherwise.


Copyright © 2017-18 CSE, CUHK, designed by Michael Ping-Fu, FUNG    Page 4 of 5
    3. Output formatting will be taken into account, e.g., word spellings, spaces, number formats, etc.

    4. Remember to do your submission on BOTH codeSubmit AND Blackboard by the due date. Late submission made within another 72-hour grace period will be accepted with a 10-point late penalty. No further late submission may be accepted.

    5. If you submit multiple times, ONLY the content and time-stamp of the latest one would be counted. You may delete (i.e. take back) your attached file and re-submit. We ONLY take into account the last submission.

    6. Markers will check your work vigorously.

    7. If your last submitted source code on codeSubmit is different from your last submitted Code::Blocks source file on Blackboard, your work on codeSubmit may be discarded and got ZERO score.

    8. To guide you through this phase, there are some relevant practical exercises on codeSubmit.

University Guideline for Plagiarism

Attention is drawn to University policy and regulations on honesty in academic work, and to the disciplinary guidelines and procedures applicable to breaches of such policy and regulations. Details may be found at http://www.cuhk.edu.hk/policy/academichonesty/. With each assignment, students are required to submit a statement that they are aware of these policies, regulations, guidelines and procedures.






































Copyright © 2017-18 CSE, CUHK, designed by Michael Ping-Fu, FUNG
Page 5 of 5


More products