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
Q. Convert the following BINARY numbers into HEXADECIMAL, double check by converting the result HEXADECIMAL to BINARY. a) 1101.0110 b) 1011.11010 c) 11110.01011

Rentrag has decided to replace all of the computers currently being used by all of the business and office staff. He has asked you to recommend a set of specification for computers

Formal Analysis: The second step of the art critiquing process often begins with an analysis of the artworks formal elements and how they are the organised. The formal elem

Determine how Simulation can be developed To determine how a simulation can be developed for use in a real situation the below illustration has been chosen. Scenario chosen is

Consider one versus the rest voting used for classifier with three classes {a, b, c}. Given a row of data denoted as x0 suppose that the classifier for a versus the rest predicts t

Describe some of applications of buffer? Applications of buffer: a. They are utilized to introduce tiny delays. b. They are utilized to eliminate cross talk caused becaus

Question: (a) Provide types of computer systems and briefly describe each one. (b) With the help of example, explain the difference between open source software, freeware a

Objectives After going through this part, you will be capable to: Examine the meaning of Pipeline processing and explain pipeline processing architectures; Classify

How WAP Gateway works? An significant feature of WAP is the maintain of telephony service integrated with micro browsing of data. aveAccess WAP Gateway functionss as a

What is an interface and what is an abstract class? Please, expand by examples of using both. Explain why.   In a interface class, all methods are abstract without execution w