Problem 1
Design a GUI program to find the weighted average of four test scores. The four test scores and their respective weights are given in the following format:

testscore1 weight1

For example, the sample data is as follows:

75 0.20
95 0.35
85 0.15
65 0.30

The user is supposed to enter the data and press a Calculate button. The program must display the weighted average.

Problem 2
Write a method, reverseDigit, that takes an integer as a parameter and returns the number with its digits reversed. For example, the value of reverseDigit(12345) is 54321. Also, write a program to test your method.

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

public class problem1 extends JFrame implements ActionListener{

    private JTextField [] testscore ;
    private JTextField [] weight ;
    private JLabel [] labels;
    private JButton calculate;
    public problem1() {
       super("Problem 1");
       setSize(400, 350);
       JPanel pane = new JPanel();
       GridLayout gl = new GridLayout(8, 3, 10, 10);
       testscore = new JTextField[6];
       weight = new JTextField[6];
       pane.add(new JLabel(" "));
       pane.add(new JLabel("Test score"));
       pane.add(new JLabel("Weight"));
       for (int i = 0; i < 6; i++) {
            pane.add(new JLabel(" data " + (i+1) + ""));
            testscore[i] = new JTextField("0");
            weight[i] = new JTextField("0");
$20.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats