-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathp12.java
More file actions
54 lines (49 loc) · 943 Bytes
/
p12.java
File metadata and controls
54 lines (49 loc) · 943 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
Write a Java program which will demonstrate a concept of Interfaces and packages: In this
assignment design and use of customized interfaces and packages for a specific application
are expected
*/
import subtask.*;
import java.util.*;
interface Exam
{
public void acceptMarks();
public void cal();
}
class Student implements Exam
{
int n;
public int sum=0;
public double per;
int []marks=new int[10];
public void acceptMarks()
{
Scanner scan= new Scanner(System.in);
System.out.println("Enter number of Subjects:");
n=scan.nextInt();
System.out.println("Enter Marks:");
for(int i=0;i<n;i++)
{
marks[i]=scan.nextInt();
}
}
public void cal()
{
for(int i=0;i<n;i++ )
{
sum=sum+marks[i];
}
per=sum/n;
}
}
class p12
{
public static void main(String args[])
{
Student s1=new Student();
StudentInfo s2=new StudentInfo();
s1.acceptMarks();
s1.cal();
s2.displayMarks(s1.sum,s1.per);
}
}