Why is my dialog box not popping up and why is it not working, please help me fix it. and possibly give me an example My Java code is below import javax.swing.JOptionPane; public class HELPME { public static void main(String[] args) { String inputString; //For reading input int numA; int numB; int numC; int numD; double gpa;

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Why is my dialog box not popping up and why is it not working, please help me fix it. and possibly give me an example My Java code is below

 

import javax.swing.JOptionPane;

public class HELPME
{
    public static void main(String[] args)
    {
    String inputString; //For reading input
   int numA;
   int numB;
   int numC;
   int numD;
  
  
   double gpa;
       
        // Have user input the number of letter grades they earned.
       
       inputString = JOptionPane.showInputDialog(null, "Enter the number of A grades received: ");
       numA =Integer.parseInt(inputString);
      
              
       inputString = JOptionPane.showInputDialog(null, "Enter the number of B grades received: ");
       numB =Integer.parseInt(inputString);
       
       inputString = JOptionPane.showInputDialog(null, "Enter the number of C grades received: ");
       numC =Integer.parseInt(inputString);
       
       inputString = JOptionPane.showInputDialog(null, "Enter the number of D grades received: ");
       numD =Integer.parseInt(inputString);
      
       // Constants representing point values and credits
        final int A_output = 6;
        final int B_output = 4;
        final int C_output = 3;
        final int D_output = 1;
        final int Points = 6;
       
        // Calculate the total number of courses attempted
        int numberOfCourses = numA + numB + numC + numD;
        int totalCreditsAttempted = numberOfCourses * Points;
       
        // Calculate the weighted total points earned
        int totalPointsEarned = (numA * A_output * Points) +
                                (numB * B_output * Points) +
                                (numC * C_output * Points) +
                                (numD * D_output * Points);

        double gpa = (double) totalPointsEarned / totalCreditsAttempted;// Calculate the GPA
     
      JOptionPane.showMessageDialog("The GPA for attempting 24 credit hours and earned grades is: %.3f", gpa); // Display the GPA with 3 decimal places
   
         
        }
        }

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 6 images

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education