Sie sind auf Seite 1von 3

Faculty of Engineering and Information Sciences

SUBJECTS INFORMATION:

Subject:
Session:
Programme / Section:
Lecturer:
Coursework Type

CSCI114 Procedural Programming


Feb 2015
J766SENG (SE) / J766CS53 (MGD) / J766CS42 (DSS) / J766MOBC (MC)
Ms. Siti Hawa

(tick appropriate box)

Individual Assignment
Lab Task

Coursework Title:

Assignment 3

Group Assignment
Seminar / Tutorial Paper

Coursework Percentage:

Project
Others

6%

ASSESSMENT CRITERIA:
Correctness
Coding
Well formatted output
Readability and
Documentation
SUBMISSION:

All programs should produce the correct result as stated in the


specification.
Programs should be well-structured using appropriate control structures
or as specified. Necessary data validation should be implemented. Correct
data types used. Functions used as specified in the question.
Output should be well formatted with appropriate messages displayed.
Numbers are shown with appropriate format and precision.
Meaningful comments are included. Meaningful identifiers used. Proper
indentation and line spacing used.

2 marks
2 marks
1 marks
1 marks

All completed work should be submitted online through Moodle before or on the due date provided.
SUBMIT AS EARLY AS POSSIBLE. ONLY ONE SUBMISSION IS ALLOWED. IF RE-SUBMISSION IS
NECESSARY, YOU ARE REQUIRED TO REMOVE THE EARLIER SUBMISSION AND THIS MUST BE DONE
BEFORE THE DUE DATE. OTHERWISE YOU WILL BE PENALIZED FOR LATE SUBMISSON.

DUE DATE:

Thursday, 21st May 2015

PENALTIES FOR LATE SUBMISSION:


Penalties apply to all late work, except if student academic consideration has been granted. Late submissions will
attract a penalty of 25% of the assessment mark per day including the weekend. Work more than (3) days late will be
awarded a mark of zero.
PLAGIARISM:
When you submit an assessment task, you are declaring the following
1. It is your own work and you did not collaborate with or copy from others.
2. You have read and understand your responsibilities under the University of Wollongong's policy on plagiarism.
3. You have not plagiarised from published work (including the internet). Where you have used the work from
others, you have referenced it in the text and provided a reference list at the end ot the assignment.
Plagiarism will not be tolerated. Students are responsible for submitting original work for assessment, without
plagiarising or cheating, abiding by the Universitys policies on Plagiarism as set out in the University Handbook
under University Policy Directory and in Faculty handbooks and subject guides. under University Policy Directory and
in Faculty handbooks and subject guides.

COURSEWORK SPECIFICATION
This assignment covers the following topics:
Functions
Remember that:
1. All programs should be able to run on the labs computers.
2. You must put the following information on the header of each text and source file you will be submitting in
this assignment:
Students full name:
Students ID:
Modification Date:
Purpose of this file (or program):
3. Assignments that are not able to be compiled will result in zero mark given to the assignment.
4. You must only use the C++ features that have already been covered in the lectures

TASKS:
Question 1
The cost to become a member of a fitness center is as follows: (a) Senior citizens discount is 30%, (b) If
membership is bought and paid for 12 or more months, the discount is 15%, (c) If more than five personal
training sessions are bought and paid for, the discount on each session is 20%.
Write a menu-driven program that determines the cost of a new membership. Your program must contain a
function that displays the general information about the fitness center and its charges; a function to read all of the
necessary information to determine the membership cost; and a function to determine the membership cost. Use
appropriate parameters to pass information in and out of a function. Do not use global variables.

Question 2
Write a program that calculates the average of a group of test scores, where the lowest score in the group is
dropped (not to be counted). It should use the following functions:

getScore() function to read a test score from the user, validate it, and return it to the main()
function. The program should call this function five times to read five inputs.
calcAverage() function to calculate and return the average of the four highest scores.
findLowest() function to find and return the lowest of the five scores passed to it. This function
should be called by calcAverage() function to determine which score to be dropped.

The program should then display the average test score.

Question 3
Write a program that lets the user play the game of Rock, Paper, and Scissors, against the computer. The
program should work as follows:

When the program begins, a random number in the range of 1 through 3 is generated. If the number is 1,
then the computer has chosen rock. If the number is 2, then the computer has chosen paper and if the
number is 3, then the computer has chosen scissors. Do not display the computers choice yet. This
should be done in a function called getComputerInput(). The random number is returned to main().
Next, get the user to input his/her choice of rock, paper, or scissors through the keyboard. You can use a
menu if you prefer. This should be done in another function called getPlayerInput() and the users choice
should be returned to main().
Pass both computers choice and players choice to another function called getWinner(). The function
should determine and return the winner to main(). If there is no winner, the function should return a
suitable value to indicate this. A winner is selected according to the following rules:
If one player chooses rock and the other player chooses scissors, then rock wins. (The rock
smashes the scissors)
If one player chooses scissors and the other player chooses paper, then scissors wins. (Scissors cut
the paper)
If one player chooses paper and the other player chooses rock, then the paper wins. (Paper wraps
rock)
If both players make the same choice, there is no winner.
The main() function should display the computers choice and declare the winner. If there is no winner,
the game must be played again to determine the winner.

Das könnte Ihnen auch gefallen