Hi,

So I have to modify code so that it is OOP rather than all algorithmic. See more details after the code below.

See my code so far:

import java.util.Scanner;
import java.util.Random;


class Die {
private static final int MAX_NUMBER = 6;
private static final int MIN_NUMBER = 1;
private static final int NO_NUMBER = 0;

public static int number;

//constructor
public Die() {
number = NO_NUMBER;
}

//Rolls of Die
public void roll() {
number = (int) (Math.floor(Math.random() *
(MAX_NUMBER - MIN_NUMBER + 1)) + MIN_NUMBER);
}


//Returns the number on this die
public int getNumber() {
return number;
}
}
public class RollDice extends Die {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub

//Uses the scanner to ask for # of rolls using the three dice.

RollDice r = new RollDice();
Scanner input = new Scanner(System.in);
System.out.println("Enter the number of rolls: ");
int x, sum1,sum2,sum3,sum4,sum5,sum6;
x = input.nextInt();
Die one, two, three;
int oneCntr = 0;
int twoCntr = 0;
int threeCntr = 0;
int fourCntr = 0;
int fiveCntr = 0;
int sixCntr = 0;


one = new Die();
two = new Die();
three = new Die();

one.roll();
two.roll();
three.roll();
//Old code
for(int i = 1; i <= x; i++){
int num = number;
if(number==1){
sum1= oneCntr++;
}
if(number==2){
sum2= twoCntr++;
}
if(number==3){
sum3= threeCntr++;
}
if(number==4){
sum4= fourCntr++;
}
if(number==5){
sum5= fiveCntr++;
}
if(number==6){
sum6= sixCntr++;
}
}


System.out.println("Results are " + one.getNumber() + " " +
two.getNumber() + " " +
three.getNumber() );

System.out.println("The face value 1 occured:" +oneCntr);
System.out.println("In percent face value 1 occurred:" +oneCntr*100/x);
System.out.println("The face value 2 occured:" +twoCntr);
System.out.println("In percent face value 2 occurred:"+twoCntr*100/x);
System.out.println("The face value 3 occurred:" +threeCntr);
System.out.println("In percent face value 3 occurred:" +threeCntr*100/x);
System.out.println("The face value 4 occured:" +fourCntr);
System.out.println("In percent face value 4 occurred:" +fourCntr*100/x);
System.out.println("The face value 5 occured:" +fiveCntr);
System.out.println("In percent face value 5 occurred:" +fiveCntr*100/x);
System.out.println("The face value 6 occured:" +sixCntr);
System.out.println("In percent face value 6 occurred:" +sixCntr*100/x);



}//end of main

}//end of RollDice.java


Objective:
To ask the user to enter the number of rolls he or she wants (this part I got done with)

To output the the results( I got it but it makes only one face value to have all the results)

To output the results by percentage of rolls from the die.
(I got this too but it makes only one face value count, and its always coming out 100 percent)