Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Computer Science, Java Eclipse basic. I almost complete, but I got lost in one p

ID: 639171 • Letter: C

Question

Computer Science, Java Eclipse basic. I almost complete, but I got lost in one part. How do I add the result of frequency to my code to show into my dialogue box?

//Template #2

package intPak;

import java.text.NumberFormat;

import java.util.Locale;

import java.util.Random;

import javax.swing.JOptionPane;

import javax.swing.JTextArea;

public class Interest {

private int dime;

private JTextArea outputTextArea;

int value;

//constructor

Interest() {

}

public void startApp(){

int iterations = 6000;

int[] faceValues = new int[2];

int value; Random r = new Random();

String results = "";

outputTextArea = new JTextArea();

outputTextArea.setText("Face Frequency ");

for (int i= 1; i <= 6; i++) {

this.value = 1+r.nextInt(6);

outputTextArea.append(i + " " + results + " "); } JOptionPane.showMessageDialog(null, outputTextArea, "Compound Interest", JOptionPane.INFORMATION_MESSAGE);

}

public static void main(String[] args) {

Interest obj = new Interest();

obj.startApp();

}

}

//Template #2 end

My answer on dialogue box contains only Face 1,2,3,4,5,6...can someone help me to include the Frequency result values? thank you

Explanation / Answer

package intPak;

import java.text.NumberFormat;

import java.util.Locale;

import java.util.Random;

import javax.swing.JOptionPane;

import javax.swing.JTextArea;

public class Interest {

private int dime;

private JTextArea outputTextArea;

int value;

//constructor

Interest() {

}

public void startApp(){

int iterations = 6000;

int[] faceValues = new int[2];

int value; Random r = new Random();

String results = "";

outputTextArea = new JTextArea();

outputTextArea.setText("Face Frequency ");

for (int i= 1; i <= 6; i++) {

this.value = 1+r.nextInt(6);

outputTextArea.append(i + " " + this.value + " "); } JOptionPane.showMessageDialog(null, outputTextArea, "Compound Interest", JOptionPane.INFORMATION_MESSAGE);

}

public static void main(String[] args) {

Interest obj = new Interest();

obj.startApp();

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote