Advertisement
AnindyaBiswas

hmm

Jun 15th, 2022
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class exam {
  4.  
  5. }
  6.  
  7. class Basic{
  8. double percentage;
  9. double full_marks;
  10.  
  11. Basic(double n)
  12. {
  13. full_marks = n;
  14. }
  15.  
  16. void getMarks()
  17. {
  18. Scanner sc = new Scanner(System.in);
  19. double[] marks = new double[5];
  20. double total = 0.0;
  21. for(int i=0; i<5; i++)
  22. {
  23. System.out.print("Enter marks in question no. " + i + " : ");
  24. marks[i] = sc.nextDouble();
  25. total = total + marks[i];
  26. }
  27.  
  28. percentage = (total / full_marks) * 100.0;
  29. }
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement