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.

import useFul.UseMe;

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


Popular posts from this blog

Program to define a class 'employee' with data members as empid, name and salary. Accept data for 5 objects using Array of objects and print it.

Program to input age from user and throw user-defined exception if entered age is negative

Define a class Student with four data members such as name, roll no.,sub1, and sub2. Define appropriate methods to initialize and display the values of data members. Also calculate total marks and percentage scored by student.