Arrays of any size, Computer Engineering

Modify your program so that the line "int numStones = ui.readStones();" in the Game constructor is considered. Depending on the value of numStones read from the user, you should create an array of stones of that size. For example, if numStones is 5, rather than 4, you should create an array of stones of size 5, rather than 4. For any given number of stones, the treasure chest should always be placed just to the right of the last stone, at position numStones+1.

You may assume that the user will enter at least 3 stones, and no more than 8 stones. You do not need to check that the user input is within range. The symbols for stones 1-8 are respectively #, @, %, $, !, ^, *, ~.

The formula for unlocking the combination of the treasure is the same as assignment1, but is extended to support any number of stones as follows:

- For 3 stones A,B,C the combination to unlock the treasure is A+B (ignoring C)

- For 4 stones A,B,C,D the combination is (A+B)*C

- For 5 stones A,B,C,D,E the combination is (A+B)*C+D

- For 6 stones A,B,C,D,E,F the combination is ((A+B)*C+D)*E

- For 7 stones A,B,C,D,E,F,G the combination is ((A+B)*C+D)*E+F

- For 8 stones A,B,C,D,E,F,G,H the combination is (((A+B)*C+D)*E+F)*G

Note: You will be penalised for using a long cascading if/else statement. Instead, you should

use a loop that successively adds and multiplies the numeric values of the stones placed in the treasure chest.

Submit to PLATE at any time to receive marks and feedback. Note that it is possible to receive partial marks for a partially working solution.

Posted Date: 3/25/2013 5:50:54 AM | Location : United States







Related Discussions:- Arrays of any size, Assignment Help, Ask Question on Arrays of any size, Get Answer, Expert's Help, Arrays of any size Discussions

Write discussion on Arrays of any size
Your posts are moderated
Related Questions
Software Estimation The statement of scope helps the planner to established estimates using one or more method which fail into two wide categories: empirical modeling and decom

Problem 1 (a) Explain the RAID system and explain all possible configurations. (b) Summarize design goals, features and specifications of the Linux ext2 file system. (c

Q. What is Small Computer Systems Interface? The other well-liked way is to connect a disk drive to a PC by a SCSI interface. Common drive choice for high-end workstations or s

Define the working of Flip Flops? Flip flop is the basic unit of storage this is used to store one bit of information. Flip-flops are the synchronous bistable devices. The term

One of the very useful things about Internet is that it enables almost instantly exchange of electronic message (e-mail) across the worlds. E-mail is a standard as well as popular

Information Gain: Now next here instantly return to the problem of trying to determine the best attribute to choose for a particular node in a tree. As in the following measur

What is framework? Framework is a skeletal structure of a program that must be elaborated to build a complete application. It has abstract classes.

Set up the minunit test framework examples in your environment (i.e. build or compile the code). Once you can run the example, use the minunit test framework to create and run a bo

The linkage section is part of a known as program that 'links' or maps to data items in the calling program are working storage. It is the part of the called program where these sh

a. Write down the salient difference among conventional T.V. and High Definition TV (HDTV) and also highlight the various benefits of digital representation for video. b. Video