Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You must submit ubmission four (4) files on D2L (Brightspace) to get credit for

ID: 3800208 • Letter: Y

Question

You must submit ubmission four (4) files on D2L (Brightspace) to get credit for this assignment (upload each Indvdully for this assignment) Instructions 1. All of the source code fil es (3): Program,java, Student,java, Auditor.java. Make sure your indicate all contributing authors as a comment in the Driver (Auditor). Implementi Implement a university Program class which maintains the name of a program (eg "SWE", "CS") and the number of core courses required to graduate in that program along with the number of elective courses required to graduate (we are simplifying degree requirements for this activity). The name of the program must be initialized when a Program is created, but the program requirements can be updated at any time so you must provide mutator methods (eg. setCore() and setElective). Since other parts of your system will need to use the requirements values, you must also provide accessor methods (eg. getCore0 and getElective(). Also Implement a Student class which set a student ld and startYear (as an int) by passing values to parameters in its constructor These fields cannot be changed once they are created. This class is responsible for tracking the number of core and selenee e courses (two separate tallies) completed by the student. Provide fields for these attributes and accessor and mutator methods for each. The mutator methods should accept a value which represents the number of additional courses to be added to the tallies of completed courses. lective The Student class should also maintain a status field. This field should be initialized to "NEW" when a student is created. However, you must provide an updateStatus0 method which automatically chang u must provide an updatestatus0 method which automatically changes the status of a student from "NEW" to "IN pleted at least 1 course. For this method to work automatically (not called by the driver), it wil PROGRESS" as soon as they have completed at least 1 course. For this method to work automatically (not called by have to be called by the accessor methods which add courses to the completed tallies. Since this method is only called from within the class, make it private. Finally, the Student class should also provide an audit) method which accepts a Program as a parameter and uses it t requirements with progress made by the student. This method should update status to "COMPLETE" when the student has met th program requirements o compar

Explanation / Answer

Hi , its really great to help you . please find below the required code and Output:

Program.java

//Program Class
public class Program {
   //Two private fields for core and elective paper
   private int core;
   private int elective;
   //Constructor for creating Program object with core and elective value
   public Program(int core , int elective){
       this.core = core;
       this.elective = elective;
   }
//Mutators and accessors
   public int getCore() {
       return core;
   }

   public void setCore(int core) {
       this.core = core;
   }

   public int getElective() {
       return elective;
   }

   public void setElective(int elective) {
       this.elective = elective;
   }

  
}

Student.java

//Student Class
public class Student {
  
//Required Private fields
   private int year;
   private int studentID;
  
   //Status field will track the status
   private String status;
   //these two private fields will track the how many papers added
   private int coreTally;
   private int electiveTally;  
  
   //Student constructor creates with id , year and also NEW status
  
   public Student(int id, int year){
       this.studentID = id;
       this.year = year;
       this.status ="NEW";
   }
   //Private mutators for setting the new status
   private void setStatus(String status){
       this.status = status;
   }

   public int getCoreTally() {
       return coreTally;
   }
//Mutators for setting the core to student and checking the size of
   //Coretally and updating the respectively status
   public void setCoreTally(int coreTally) {
       if(coreTally>0){
           setStatus("IN PROGRESS");
       }
       this.coreTally = this.coreTally+coreTally;
   }

   public int getElectiveTally() {
       return electiveTally;
   }
   //Mutators for setting the core to student and checking the size of
       //electivetally and updating the respectively status
   public void setElectiveTally(int electiveTally) {
       if(electiveTally>0){
           setStatus("IN PROGRESS");
       }
       this.electiveTally = this.electiveTally+electiveTally;
   }
   //Audit method for student that will check the no of core and
   //elective completed by student if all complete then it will update status to Complete
   public void audit(Program program){
       if(program.getCore()==getCoreTally() && program.getElective()==getElectiveTally()){
          
           setStatus("COMPLETE");
       }
       System.out.println("Student "+studentID+": started in "+year+", status = "
               + status);
   }
  
  
}

Auditor.java

public class Auditor {

   public static void main(String[] args) {
      
       //Progran cs created with 40 core and 2 elective
       Program cs = new Program(40, 2);
       //student stu created with id and roll no and as per constructor status will set to NEW
       Student stu = new Student(1903, 2017);
       //Beore adding any core or elective printing
       stu.audit(cs);
       //34 core added
       System.out.println(" Adding 34 core tally ... ");
       stu.setCoreTally(34);
       //printing the audit
       stu.audit(cs);
       //2 elective added
       System.out.println(" Adding 2 elective tally ... ");
       stu.setElectiveTally(2);
       //printing the audit
       stu.audit(cs);
       //remaining 6 core added to student
       System.out.println(" Adding 6 core tally ... ");
       stu.setCoreTally(6);
       //printing audit
       stu.audit(cs);
      

   }

}

OUTPUT:

Apologize, Due to some technical glitch Image not getting uploaded, how i am pasting exact same text from Console. Output as per below:

Student 1903: started in 2017, status = NEW

Adding 34 core tally ...

Student 1903: started in 2017, status = IN PROGRESS

Adding 2 elective tally ...

Student 1903: started in 2017, status = IN PROGRESS

Adding 6 core tally ...

Student 1903: started in 2017, status = COMPLETE

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote