Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

i want to add the total correct but idont how to do

$
0
0
import javax.swing.*;
public class one{
public static void main(String[]args){
String Category = JOptionPane.showInputDialog(null,"Category:"+"\na: Math"+"\nb: Science"+"\nc: Social"+"\nd: PE");
if(Category.equals("a"))
{
String q1 = JOptionPane.showInputDialog(null,"Math\n"+"?" + "\na:" + "\nb:" + "\nc:"+"\nd:");
if(q1.equals("a"))
{
JOptionPane.showMessageDialog(null,"The Answer is Correct");
}
else
{
JOptionPane.showMessageDialog(null,"The Answer is Wrong");
}
String q2 = JOptionPane.showInputDialog(null,"Math\n"+"?" + "\na:" + "\nb:" + "\nc:"+"\nd:");
if(q2.equals("a"))
{
JOptionPane.showMessageDialog(null,"The Answer is Correct");
}
else
{
JOptionPane.showMessageDialog(null,"The Answer is Wrong");
}
JOptionPane.showMessageDialog(null,(q1+q2));
}

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>