Monday, 28 November 2016

Program to define class 'Student' to calculate the percentage. Import the above package 'useFul' and make use of the method percentage( )

In this program we use the package useFul to import the class UseMe in another class Student. Here we have used the percentage( ) method of UseMe class to calculate the percentage of student.


PROGRAM
import useFul.UseMe;

class Student
{
 public static void main(String b[])
 {
  UseMe u3 = new UseMe();
  u3.percentage(600,450);
 }
}
OUTPUT
C:\>javac Student.java
C:\>java Student
Total marks = 600
Obtained marks = 450
Percentage = 75.0

No comments:

Post a Comment