Dear experts,

I am trying to practice inheritance coding on my own but i have met some difficulties.

I ma supposed to come up with a Square Game with M representing the number of squares. For the start, i will be in the square 0 value and playing by throwing dice. There are 2 types of squares, Standard square (represented by 0) and Unique Square (represented by 1). Both have value attribute ( can be negative or positive), and Unique Square has one more attribute called multiplier. When land on Standard Square, i need to get points according to the 'value' of the square. When land on Unique Square, i need to multiply my current score with 'multiplier' first, then add 'value'. I am also required to out print my final score at the end.

I have figured out the algorithm, please kindly take a look at the image which i have attached in this thread.

Here's the sample input:

5

0 5.25

0 -3.14

1 2.17 1.50

0 5.39

1 -3.32 2.00

3 3 1 2

Here's the sample output which i was given:

Points: 7.77

```
import java.util.*;
import java.text.*;
class Game{
public static int[] MakeArray (int size, int value){
int [] Array = new int[size];
for (int i = 0; i < Array.length; i++){
Array[i] = value;
} return Array;
}
public static void main(String[] args){
// declare the necessary variables
int M, squaretype;
double curPoints = 0;
double multiplier, value;
int[] arrayRef;
// declare a Scanner object to read input
Scanner sc = new Scanner(System.in);
M = sc.nextInt();
for (int i = 0; i < M; i++){
squaretype = sc.nextInt();
value = sc.nextDouble();
multiplier = sc.nextDouble();
arrayRef = MakeArray (M,value);
} [B]// how should i continue?[/B]
DecimalFormat twoDecimalFormat = new DecimalFormat("0.00"); // format to 2 decimal place
System.out.println("Points: " + twoDecimalFormat.format(curPoints));
}
}
class Square{
double _value; // value which can be positive or negative
public double getValue() {
return _value;
}
public double changePoints(double curPoints){
return (curPoints + _value);
}
}
class UniqueSquare extends Square{
double _multiplier;
public double getMultiplier (){
return _multiplier;
}
public double changePoints(double curPoints){
return((curPoints*_multiplier)+ _value);
}
}
```

Thank you so much for all your kind guidance.