Advertisement
RashedBQ

Exam

Apr 6th, 2021
79
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package marks;
  2.  
  3. class Mark
  4. {
  5.     int math,english,programming;
  6.      void mark(int math,int english,int programming)
  7.     {
  8.         this.math = math;
  9.         this.english = english;
  10.         this.programming = programming;
  11.     }
  12. }
  13.  
  14. class Student
  15. {
  16.     int id;
  17.     String name;
  18.     Mark mark;
  19.     void Student(int id,String name,Mark mark)
  20.     {
  21.         this.id = id;
  22.         this.name = name;
  23.         this.mark = mark;
  24.     }
  25.     void show()
  26.     {
  27.         System.out.println("Id: "+id);
  28.         System.out.println("Name: "+name);
  29.         System.out.print("\n");
  30.         System.out.println("Marks");
  31.         System.out.println("--------");
  32.         System.out.println("English: "+mark.english);
  33.         System.out.println("Math: "+mark.math);
  34.         System.out.println("Programming: "+mark.programming);
  35.     }
  36. }
  37.  
  38. public class Marks {
  39.  
  40.    
  41.     public static void main(String[] args) {
  42.         Mark M = new Mark();
  43.         Student S = new Student();
  44.        
  45.         M.mark(10, 7, 8);
  46.         S.Student(1, "Ali", M);
  47.         S.show();
  48.     }
  49.    
  50. }
Advertisement
RAW Paste Data Copied
Advertisement