Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- class student{
- int id;
- int semesterno;
- String name;
- String course;
- double cgpa;
- double gpa;
- student(String n, int i, int sn, double g){
- name=n;
- id= i;
- semesterno=sn;
- gpa=g;
- }
- double cgpacalculate(double java, double algo, double database){
- return cgpa=(java+algo+database)/3;
- }
- void display(){
- System.out.println("Student ID: "+id);
- System.out.println("Student Name: "+name);
- System.out.println("Semester No: "+semesterno);
- System.out.println("CGPA: "+cgpa);
- }
- }
- class Solve{
- public static void main(String[] args){
- student std = new student("ismail", 17135196, 4, 3.55);
- std.cgpacalculate(3.94, 3.88, 4.00);
- std.display();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement