uber basc java - making the leap from non-object to object oriented
I created a program that only has a main method, and out of curiosty, i want to make it object oriented, even though it would probably require more work. Ive been dinking around with the code, and somehow i can't make the leap
here is my code, with a single main method. my question about it is how can i break down this code into a main method as well as a object that is called to accomplish the exact same thing.
import java.util.Scanner;
import java.util.Random;
public class part3_c
{
public static void main (String[] args)
{
//constructing the scanner class so that use can input values
Scanner scan = new Scanner (System.in);
//contructing random generator
Random generator = new Random();
//declaring variable that will house the user's input
int one;
int rone;
int rtwo;
int rthree;
System.out.println("Enter a number");
one = scan.nextInt();
//creating three random intergers that are all less than the first inputed interger
rone = generator.nextInt(one);
rtwo = generator.nextInt(one);
rthree = generator.nextInt(one);
//printing out the result
System.out.println("The number you picked and three random numbers less than it where " + one + "," + rone + "," + rtwo + "," + rthree);
//printing out the average of all 4 numbers
System.out.println("The average of your numbers is " + (one + rone + rtwo + rthree)/3 );
}
}

