Billy 6) TECHNOLOGICAL UNIVERSITY DUBLIN
DT6522 DT6524 DT6525
Access & International Foundation Programmes
SUPPLEMENTAL EXAMINATIONS 2019/20
EXAM ALTERNATIVE ASSESSMENT
Introduction to Computer Science II - Programming
Internal Examiner: Nevan Bermingham
External Examiner: Sriyani Jayaweera
Answer all Components
Submission is in Microsoft Word format only
Submission via Brightspace before the deadline – no other method of submission is permitted
Question 1 of 1 – Answer both parts. [100 marks]
Based on the program description below, provide the following:
PART (A) Create a flowchart for the program ensuring sufficient level of detail and appropriate shape elements to denote start/finish, actions, conditions and I/O. Please use a package like Microsoft Publisher (with page size A3 or larger) to create your flowchart. MS Publisher is available to all TU Dublin students free of charge.
PART (B) Write the code for the program outlined in your flow chart in Java that meets the specification outlined in the description below. Your code should be submitted in a text file format.
The Program Description:
The program plays a dice roll game with the user. The user can win money based on their outcome of the game, and they start with €30 initially.
The computer rolls two dice. Once dice for the computer and one for the user. The dice have a random number for each throw ranging from one to six per dice. If the user’s dice is higher, they win €20 (€10 for winning and they get their game cost of €10 back). If it is the same, they get their money back. If the computer wins, they lose their €10. They can then opt to play again or withdraw their money and finish.
The program will need to include the following:
1. Ask the user for their name.
2. Allocate €30 to the user as their opening balance.
3. Each play of the game costs the user €10, deducted before the dice is rolled.
4. Computer rolls a dice for itself (value 1-6)
5. The computer then rolls a dice for the user (value 1-6)
6. The win/lose rules are as follows:
a. If the user’s dice is greater than the computer’s dice, the user wins €20.
b. If users’ dice is greater than the computer’s dice, the user wins €10.
c. If users’ dice is lower than the computer’s dice, the computer wins, and the user loses their €10.
7. The user can opt to play the game again or not by entering Y/y or N/n, but only if they have sufficient funds (at least €10 left) to play.
8. The game should exit (i.e. not allow them to play again) if they have no money left to play.
9. If they decide to exit, they are told how much money they have in total and goodbye, otherwise they get to play again.
· You should use concise and meaningful comments in your code that clearly outline what you code is doing at any point.
· Your programme should use the users’ name in all on screen communications.
· You should include error checking at every stage of your code to validate user input.
· The user should be told at all times what balance is.
· Your program should include enhancements to make the game more enjoyable, but what these will be is up to you
· There are extra marks (7 Marks) for the implementation of at least one method.
FLOW CHART 40 Marks:
Flowchart has sufficient detail to explain the program flow 50%
Flowchart accurately explains the flow 50%
Note: Flowchart must match exactly the submitted java program code.
The correct shapes must be used for each element.
Marks will be lost for non-adherence.
CODE 60 Marks:
Program delivers to the specifications described 70%
Use of methods and/or other advanced/efficient coding techniques 10%
Program augmentations that add improved playability 10%
Program can run (compiled) as described 10%
NOTE: Negative marking scheme is employed for each syntax errors and/or incorrect keywords.
Marks lost for using inefficient code, redundant/unnecessary code or poor variable naming.
Marks will be deducted if comments are not sufficiently descriptive of your code.
As this is an open book exam, the following describes what is and is not permitted:
What is NOT Permitted:
Use of class notes.
Working in a group.
(this is an individual assessment)
Using internet sites for reference.
Copying code off the internet.
Using books for reference.
Sharing code with other students.
Using Lab work as examples.
Asking or getting help from someone else.
Submitted your own work, even if the code is not correct or does not compile.
Paying someone else to do the work.
| || |
Getting someone else to do the work for you.
| || |
Submitting work that is not entirely your effort