JAVA

PART -A

PROGRAM 1 PROGRAM 2 PROGRAM 3 PROGRAM 4 PROGRAM 5 PROGRAM 6 PROGRAM 7

PART-B

PROGRAM B1 PROGRAM B2 PROGRAM B3 PROGRAM B4 PROGRAM B5 PROGRAM B6 PROGRAM B7 PROGRAM B8 . . .

 
  
 
 
 
 
 
 .3.Write a java code to create a class with data members name, category, doj, and fees and static members total_fee, categorywise_no_students, methods to Insert data using parameterized constructor, display student information along with total fees and number of students in each category.

 class StudentClassWithMultipleMethods
{
    public static void main(String arg[])
    {
        Student s1 = new Student("Raj1","SC","1/2/2021",1000);
         Student s2 = new Student("YUVA","GM","1/2/2021",2000);
         Student s3 = new Student("RAM","GM","1/2/2021",3000);

         s1.displayInfo ();
        s2.displayInfo ();
        s3.displayInfo ();

        Student.displaySummary();
    }
}

class Student
{
    String name;
    // Marks in various subjects
    String category, doj;
    int fee; 
    static int total_fee, categorywiseStudentGM ,categorywiseStudentSC,categorywiseStudent3A;


    static void updatestaticDATA(String category,int fee)
    {
     
         total_fee=total_fee+fee;
          
          if(category.equals("GM"))
            categorywiseStudentGM=categorywiseStudentGM+1;
          if(category.equals("SC"))
            categorywiseStudentSC=categorywiseStudentSC+1;
         if(category.equals("3A"))
            categorywiseStudent3A=categorywiseStudent3A+1;
    }


   static void  displaySummary(){
     System.out.println("Summary  ");
        System.out.println("-------------------------------------------------");
        System.out.println("Total Fee : "+total_fee);
        System.out.println("-------------------------------------------------");
        System.out.println("categorywiseStudentGM : "+categorywiseStudentGM);
       System.out.println("-------------------------------------------------");
        System.out.println("categorywiseStudentSC : "+categorywiseStudentSC);
    }

    void displayInfo ()
    {
        System.out.println("-------------------------------------------------");
        System.out.println("Detailed Marks");
        System.out.println("-------------------------------------------------");
        System.out.println("NAME : "+name);
        System.out.println("category : "+category);
         System.out.println("Date of joining : "+doj);
         System.out.println("Fee paind : "+fee);
        System.out.println("-------------------------------------------------");  
    }

   public Student(String nameT,String categoryT,String dojT,int feeT){

        name=nameT;
        category=categoryT;
        doj=dojT;
        fee=feeT;
            updatestaticDATA(categoryT,fee);
       }    }