Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class exam {
- }
- class Basic{
- double percentage;
- double full_marks;
- Basic(double n)
- {
- full_marks = n;
- }
- void getMarks()
- {
- Scanner sc = new Scanner(System.in);
- double[] marks = new double[5];
- double total = 0.0;
- for(int i=0; i<5; i++)
- {
- System.out.print("Enter marks in question no. " + i + " : ");
- marks[i] = sc.nextDouble();
- total = total + marks[i];
- }
- percentage = (total / full_marks) * 100.0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement