import javax.swing.JOptionPane;
class IfElseMarksheet{
public static void main(String[]args) throws Exception{
String a = JOptionPane.showInputDialog("Enter Java Marks");
int java = Integer.parseInt(a);
String b = JOptionPane.showInputDialog("Enter PHP Marks");
int php = Integer.parseInt(b);
String c = JOptionPane.showInputDialog("Enter VB Marks");
int vb = Integer.parseInt(c);
String d = JOptionPane.showInputDialog("Enter C++ Marks");
int cpp = Integer.parseInt(d);
String e = JOptionPane.showInputDialog("Enter Ruby Marks");
int ruby = Integer.parseInt(e);
int total = 500;
int obtained = java + php + cpp + vb + ruby;
int percentage = obtained * 100 / total;
if(java >39){
if(php > 39)
if(vb > 39)
if(cpp > 39)
if(ruby > 39)
if(percentage < 100)
if(percentage >= 80)
JOptionPane.showMessageDialog(null, "Total Marks Are :" + total +
"\n Obtained Marks Are : " + obtained +
"\n Percentage is : " + percentage +"%" +
"\n You Are Pass" + "\n You Got A+ Grade");
}
else if(java >39){
if(php > 39)
if(vb > 39)
if(cpp > 39)
if(ruby > 39)
if(percentage < 80)
if(percentage >= 70)
JOptionPane.showMessageDialog(null, "Total Marks Are :" + total +
"\n Obtained Marks Are : " + obtained +
"\n Percentage is : " + percentage +"%" +
"\n You Are Pass" + "\n You Got A Grade");
}
else if(java >39){
if(php > 39)
if(vb > 39)
if(cpp > 39)
if(ruby > 39)
if(percentage < 70)
if(percentage >= 60)
JOptionPane.showMessageDialog(null, "Total Marks Are :" + total +
"\n Obtained Marks Are : " + obtained +
"\n Percentage is : " + percentage +"%" +
"\n You Are Pass" + "\n You Got B Grade");
}
else if(java >39){
if(php > 39)
if(vb > 39)
if(cpp > 39)
if(ruby > 39)
if(percentage < 60)
if(percentage >= 50)
JOptionPane.showMessageDialog(null, "Total Marks Are :" + total +
"\n Obtained Marks Are : " + obtained +
"\n Percentage is : " + percentage +"%" +
"\n You Are Pass" + "\n You Got C Grade");
}
else if(java >39){
if(php > 39)
if(vb > 39)
if(cpp > 39)
if(ruby > 39)
if(percentage < 50)
if(percentage >= 40)
JOptionPane.showMessageDialog(null, "Total Marks Are :" + total +
"\n Obtained Marks Are : " + obtained +
"\n Percentage is : " + percentage +"%" +
"\n You Are Pass" + "\n You Got D Grade");
}
else{
JOptionPane.showMessageDialog(null, "Total Marks Are :" + total +
"\n Obtained Marks Are : " + obtained +
"\n Percentage is : " + percentage +"%" +
"\n You Are Fail");
}
}
}
class IfElseMarksheet{
public static void main(String[]args) throws Exception{
String a = JOptionPane.showInputDialog("Enter Java Marks");
int java = Integer.parseInt(a);
String b = JOptionPane.showInputDialog("Enter PHP Marks");
int php = Integer.parseInt(b);
String c = JOptionPane.showInputDialog("Enter VB Marks");
int vb = Integer.parseInt(c);
String d = JOptionPane.showInputDialog("Enter C++ Marks");
int cpp = Integer.parseInt(d);
String e = JOptionPane.showInputDialog("Enter Ruby Marks");
int ruby = Integer.parseInt(e);
int total = 500;
int obtained = java + php + cpp + vb + ruby;
int percentage = obtained * 100 / total;
if(java >39){
if(php > 39)
if(vb > 39)
if(cpp > 39)
if(ruby > 39)
if(percentage < 100)
if(percentage >= 80)
JOptionPane.showMessageDialog(null, "Total Marks Are :" + total +
"\n Obtained Marks Are : " + obtained +
"\n Percentage is : " + percentage +"%" +
"\n You Are Pass" + "\n You Got A+ Grade");
}
else if(java >39){
if(php > 39)
if(vb > 39)
if(cpp > 39)
if(ruby > 39)
if(percentage < 80)
if(percentage >= 70)
JOptionPane.showMessageDialog(null, "Total Marks Are :" + total +
"\n Obtained Marks Are : " + obtained +
"\n Percentage is : " + percentage +"%" +
"\n You Are Pass" + "\n You Got A Grade");
}
else if(java >39){
if(php > 39)
if(vb > 39)
if(cpp > 39)
if(ruby > 39)
if(percentage < 70)
if(percentage >= 60)
JOptionPane.showMessageDialog(null, "Total Marks Are :" + total +
"\n Obtained Marks Are : " + obtained +
"\n Percentage is : " + percentage +"%" +
"\n You Are Pass" + "\n You Got B Grade");
}
else if(java >39){
if(php > 39)
if(vb > 39)
if(cpp > 39)
if(ruby > 39)
if(percentage < 60)
if(percentage >= 50)
JOptionPane.showMessageDialog(null, "Total Marks Are :" + total +
"\n Obtained Marks Are : " + obtained +
"\n Percentage is : " + percentage +"%" +
"\n You Are Pass" + "\n You Got C Grade");
}
else if(java >39){
if(php > 39)
if(vb > 39)
if(cpp > 39)
if(ruby > 39)
if(percentage < 50)
if(percentage >= 40)
JOptionPane.showMessageDialog(null, "Total Marks Are :" + total +
"\n Obtained Marks Are : " + obtained +
"\n Percentage is : " + percentage +"%" +
"\n You Are Pass" + "\n You Got D Grade");
}
else{
JOptionPane.showMessageDialog(null, "Total Marks Are :" + total +
"\n Obtained Marks Are : " + obtained +
"\n Percentage is : " + percentage +"%" +
"\n You Are Fail");
}
}
}
No comments:
Post a Comment