Results 1 to 4 of 4
- 02-18-2012, 04:06 PM #1
Member
- Join Date
- Feb 2012
- Posts
- 3
- Rep Power
- 0
How to display a grid using dialog box?
Hi could somebody please help me. I am currently making a program that will get the average of the 3 scores of each of the 2 subjects.(math and english). I'm done making the program but the thing that I can't seem to make is how to display it inside a grid using a dialog box. I tried using special alt keys to manually make it but it didn't work. Here's my code:
Java Code:import javax.swing.*; public class average { public static void main(String[]args) { int eng1,eng2,eng3,math1,math2,math3; double ave1,ave2; String S1; S1 = JOptionPane.showInputDialog("Enter 1st Quiz Grade in English: "); eng1 = Integer.parseInt(S1); S1 = JOptionPane.showInputDialog("Enter 2st Quiz Grade in English: "); eng2 = Integer.parseInt(S1); S1 = JOptionPane.showInputDialog("Enter 3st Quiz Grade in English: "); eng3 = Integer.parseInt(S1); S1 = JOptionPane.showInputDialog("Enter 3st Quiz Grade in English: "); math1 = Integer.parseInt(S1); S1 = JOptionPane.showInputDialog("Enter 3st Quiz Grade in English: "); math2= Integer.parseInt(S1); S1 = JOptionPane.showInputDialog("Enter 3st Quiz Grade in English: "); math3 = Integer.parseInt(S1); ave1=(math1+math2+math3)/3; ave2=(eng1+eng2+eng3)/3; JOptionPane.showMessageDialog(null, "\nSubject 1 2 3" +"\nEnglish " +" "+eng1+" " +eng2+" "+eng3 +"\nMathematics " +" "+math1+ " " +math2+ " " +math3 +"\n Math Gen Ave"+ave1 +"\n English Gen Ave"+ave2,"Report", JOptionPane.INFORMATION_MESSAGE); } }Last edited by januaryako; 02-19-2012 at 01:40 AM. Reason: code tags added
- 02-18-2012, 05:03 PM #2
Senior Member
- Join Date
- Nov 2011
- Location
- Turkey
- Posts
- 378
- Blog Entries
- 24
- Rep Power
- 2
Re: How to display a grid using dialog box?
I think you should remove the + after null, and what is ave ?
- 02-19-2012, 01:38 AM #3
Member
- Join Date
- Feb 2012
- Posts
- 3
- Rep Power
- 0
Re: How to display a grid using dialog box?
ohh sorry forgot to remvoe the + after the null, wait let me fix it. the ave should be only one for each subject hehe
- 02-19-2012, 01:41 AM #4
Member
- Join Date
- Feb 2012
- Posts
- 3
- Rep Power
- 0
Similar Threads
-
Struts: How to display a grid in Struts??
By fabbero in forum New To JavaReplies: 1Last Post: 07-13-2011, 05:18 PM -
JOptionPane - Message dialog box does not display
By aibao in forum NetBeansReplies: 4Last Post: 05-15-2011, 04:47 AM -
How to display array integer in JOptionPane message dialog ?
By Reero8532 in forum New To JavaReplies: 13Last Post: 03-20-2010, 01:03 AM -
How to display a list of items and on click display subitems?
By mandyj in forum New To JavaReplies: 8Last Post: 12-29-2008, 07:12 AM -
How to handle each display/shell dialog box (not knowed) and choose default answer
By lenar in forum SWT / JFaceReplies: 0Last Post: 04-04-2008, 12:15 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks