import java.util.Scanner;
interface Exam
{
    void percentage_cal();
}
class Student implements Exam
{
    int rno;
    String name;
    int marks1;
    int marks2;
    Student(int rno,String name,int marks1,int marks2)
    {
        this.rno=rno;
        this.name=name;
        this.marks1=marks1;
        this.marks2=marks2;
    }
   public void percentage_cal()
    {
        float sum=marks1+marks2;
        float per=(sum/200)*100;
        System.out.println("Percentage: "+per+"%");
    }
    void display()
    {
        System.out.println("Name of Student: "+name);
        System.out.println("Roll No. of Student: "+rno);
        System.out.println("Marks of Subject 1: "+marks1);
        System.out.println("Marks of Subject 2: "+marks2);
    }
}
class MultipleInheritance
{
    public static void main(String[] args)
    {
        Scanner sc=new Scanner(System.in);
        String name=sc.nextLine();
        int rno=sc.nextInt();
        int marks1=sc.nextInt();
        int marks2=sc.nextInt();
        Student s=new Student(rno,name,marks1,marks2);
        s.display();
        s.percentage_cal();
    }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: