I was creating this code and I hit a brick wall. Maybe because I have been doing this code for 5 hours and I am burnt out. I just need help to get it working please. Here is the code
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.Random;
public class RandomNumbers4 extends JApplet implements ActionListener
{
FlowLayout flow = new FlowLayout();
Container con = getContentPane();
JButton cButton = new JButton ("Compute");
Font font = new Font("Times Roman",Font.BOLD, 12);
JLabel ranVal = new JLabel("Random Values: ");
JLabel lowVal = new JLabel ("Low Value: ");
JLabel hiVal = new JLabel ("High Value: ");
JLabel avVal = new JLabel ("Average Value: ");
int Random[] = new int [5];
int value = 0;
int max =0, min = 0;
int sum = 0;
public void init()
{
con.setLayout (flow);
con.add(cButton);
con.add(ranVal);
con.add(lowVal);
con.add(hiVal);
con.add(avVal);
ranVal.setFont(font);
lowVal.setFont(font);
hiVal.setFont(font);
avVal.setFont(font);
cButton.addActionListener(this);
}
public static int randomNumber (int value)
{
int choose=0;
choose = 60 + (int)(Math.random()*40);
return choose;
}
//maximum number generator
public static int findMaximum(int maximum)
{
int max = 0;
if (maximum > max)
max = maximum;
return max;
}
//average generator
public static int findAverage (int sum)
{
int avg = 0;
avg = sum/5;
return avg;
}
public static int findMinimum(int minimum)
{
int min = 0;
if (minimum < min)
min = minimum;
return min;
public void actionPerformed(ActionEvent e)
{
Object source = e.getSource();
if (source == cButton)
ranVal + choose; lowVal + min; hiVal + max;
avVal + average;
}
}