Computer science NEA 2019 task 2Watch

Announcements
#1
Help can someone send me their code for task 2 im stuck and have no clue how to do this
0
3 weeks ago
#2
I am a CS student at A-Level, im not doing the NEA but what is the issue and ill see if can help.
0
#3

(Original post by jmh9374)
I am a CS student at A-Level, im not doing the NEA but what is the issue and ill see if can help.
0
3 weeks ago
#4
Okay the way I would personally do this is have a while loop and have a variable that increases by one every time it loops. Then when the loop hits 5 then it breaks out of the while loop and then you calculate the scores. To deal with the doubles you can just have a if statement stating if the two dices have the same number roll another one. Also to handle the die I would have THREE dice variables called something like; intDieOne, intDieTwo, intDieThree so that you can easily add them to their scores in the loop you also want to make sure at the start of each loop these are reset or you might get an error. Once calculated the scores and if they are the same (Just use a if statement to test this) roll another dice for each. The odd and even is easy as if you divide by 2 if it is a whole number it is even (a int) or if it has decimal and need to be converted to a float its odd. To roll dice it depends on the language you are using but almost all new-ish languages have a random function with the ability to change the min and max numbers rolled.

If you have any questions feel free to ask.
0
3 weeks ago
#5
(Original post by Ocean7647)
Help can someone send me their code for task 2 im stuck and have no clue how to do this
(the answer is the same in any language..)
Last edited by winterscoming; 3 weeks ago
0
X

new posts
Back
to top
Latest
My Feed

Oops, nobody has postedin the last few hours.

Why not re-start the conversation?

see more

See more of what you like onThe Student Room

You can personalise what you see on TSR. Tell us a little about yourself to get started.

University open days

• Bournemouth University
Midwifery Open Day at Portsmouth Campus Undergraduate
Wed, 16 Oct '19
• Teesside University
Wed, 16 Oct '19
• University of the Arts London
London College of Fashion – Cordwainers Footwear and Bags & Accessories Undergraduate
Wed, 16 Oct '19

Poll

Join the discussion

How has the start of this academic year been for you?

Loving it - gonna be a great year (131)
17.99%
It's just nice to be back! (197)
27.06%
Not great so far... (263)
36.13%
I want to drop out! (137)
18.82%