Advertisement
Ksap7

Finished

Feb 8th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package prg;
  7.  
  8. import javax.swing.JOptionPane;
  9.  
  10. /**
  11. *
  12. * @author Gjorge
  13. */
  14. public class PRG {
  15.  
  16. /**
  17. * @param args the command line arguments
  18. */
  19.  
  20. public static void main(String[] args) {
  21.  
  22. // TODO code application logic here.
  23.  
  24. String sNum_1, sNum_2, sNum_3, sNum_4, sNum_5, sNum_6, sNum_7, sAverage;
  25.  
  26. double dNum_1, dNum_2, dNum_3, dNum_4, dNum_5, dNum_6, dNum_7, dAverage;
  27.  
  28. sNum_1= JOptionPane.showInputDialog(" Enter first mark: ");
  29. sNum_2= JOptionPane.showInputDialog("Enter second mark:");
  30. sNum_3= JOptionPane.showInputDialog("Enter third mark:");
  31. sNum_4= JOptionPane.showInputDialog("Enter fourth mark:");
  32. sNum_5= JOptionPane.showInputDialog("Enter fifth mark:");
  33. sNum_6= JOptionPane.showInputDialog("Enter sixth mark:");
  34. sNum_7= JOptionPane.showInputDialog("Enter seventh mark:");
  35.  
  36.  
  37. dNum_1= Double.parseDouble(sNum_1);
  38. dNum_2= Double.parseDouble(sNum_2);
  39. dNum_3= Double.parseDouble(sNum_3);
  40. dNum_4= Double.parseDouble(sNum_4);
  41. dNum_5= Double.parseDouble(sNum_5);
  42. dNum_6= Double.parseDouble(sNum_6);
  43. dNum_7= Double.parseDouble(sNum_7);
  44.  
  45.  
  46.  
  47.  
  48. dAverage= ( (dNum_1 + dNum_2 + dNum_3 + dNum_4 + dNum_5 + dNum_6 + dNum_7) / 7) ;
  49. if ( dAverage < 50 )
  50. { sAverage = "Fail.";
  51.  
  52. }
  53. else { sAverage = "Pass.";
  54.  
  55. }
  56.  
  57. System.out.println(sAverage);
  58. }
  59.  
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement