Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java game deal or no deal

 
sahmira bi
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ppl
iv got a piece of java cwk and have no idea what needs to be done. help???
Welcome to Deal or No Deal
Allocating cash values to boxes... done...
Contestant, please choose a box from 1 to
22.
> 12
Your choice has been successful.
The following cash values still remain:
1p �1000
10p �3000
50p �5000
�1 �10,000
�5 �15,000
�10 �20,000
�50 �35,000
�100 �50,000
�250 �75,000
�500 �100,000
�750 �250,000
The following boxes still remain:
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15,
16, 17, 18, 19, 20, 21, 22
Contestant, please choose a box to open:
> 9
Your choice has been successful.
Opening box... the box contains �100.
The following cash values still remain:
1p �1000
10p �3000
50p �5000
�1 �10,000
�5 �15,000
�10 �20,000
�50 �35,000
�50,000
�250 �75,000
�500 �100,000
�750 �250,000

above is the sample output.
 
Stephen Foy
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Im sure you know how to declare arrays, each value can be stored into an array. Which is possibly the best way.



Hope this gives you a start.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic