Question
Imagine a guideline is developed that advises students on how to manage assignments. A student who uses guideline will create an AssignPlan each day, that
Imagine a guideline is developed that advises students on how to manage assignments. A student who uses guideline will create an AssignPlan each day, that will manage summarized data about the set of assignments. The student will then create each Assignment to be done that day. For this lab, we will make the simplifying assumption that all assignments can be done within a day (ie. No assignment will be carried forward to another day). Also, note that while a real implementation may associate each Assignment with an AssignPlan, for this lab we are not concerned with coding the associations.
Please complete the following:
import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.util.*; import java.util.concurrent.*; import java.util.function.*; import java.util.regex.*; import java.util.stream.*; import static java.util.stream.Collectors.joining; import static java.util.stream.Collectors.toList;
//Implement the AssignPlan class here
class AssignPlan{ private String highestPriorityItem=""; private int numAssignments, numComplete, hoursAvailable; private double totalPoints;
//Question 1. Properly implement accessor methods for the private variables highestPriorityItem, numAssignments, numComplete, hoursAvailable, totalPoints. private String getHighestPriorityItem(){return highestPriorityItem;} public int getNumAssignments(){return 0;} public int getNumComplete(){return 0;} public int getHoursAvailable(){return 0;} public double getTotalPoints(){return 0.0;} //accessor for the private variables private String gethighPriorityItem() { return highPriorityItem; } public int getnumAssignment() { return this.numAssignment; } public int getnumComplete() { return this.numComplete; } public int gethoursAvailable() { return this.hoursAvailable; } public double gettotalPoints() { return this.totalPoints; } public String toString(){
return "====================== " + "-----TODAY'S PLAN----- " + "---------------------- " + "Priority:"+getHighestPriorityItem()+" " + "Assignments:"+getNumAssignments()+" " + "Completed:"+getNumComplete()+" " + "Hours Avail:"+getHoursAvailable()+" " + "Tot. Points:"+getTotalPoints()+" "; }
public AssignPlan(){ }
public AssignPlan(int numAssigns){ numAssignments = numAssigns; } //Question 2. Implement an alternate constructor for DailySchedule public AssignPlan(String hPriorityItem, int nAssigns, int nComplete, int hAvailable, double tPoints){ //complete this constructor this.highPriorityItem=highPriorityItem; this.numAssignment=numAssigns; this.numComplete=numComplete; this.hoursAvailable=hoursAvailable; this.totalPoints=totalPoints;
}
//Question 3. Implement a mutator function to set the highestPriorityItem public void setPriorityTo(String aname) { this.highPriorityItem=aname; } public void handleUrgentAssignment (String name, int effort, int resources, int difficulty) { Assignment newAssignment=new Assignment(name,efforts,resources,difficulty); int nAssigns=nAssigns+1; int nComplete=nComplete+1; int hAvailable=hAvailable-effort; double tPoints=tPoints+ Assignment.expScore(effort, difficulty, resources); highPriorityItem=name; }
}
class Assignment { private int n_cmp; private int est_diff; private int no_res; private int exp_score; private double expScore; //constructor public Assignment(int n_cmp, int est_diff, int no_res){ this.name=name; this.efforts=efforts; this.numResources=numResources; this.estDifficulty=estDifficulty; this.expScore=0.1*(this.efforts*estDifficulty+Math.pow(this.efforts*numResources,2)/(Math.PI*Math.sqrt(estDifficulty))); } //accessor methods of private variable public String getName() { return name; } public int getEfforts() { return efforts; } public int getResources() { return numResources; } public int getDifficulty() { return estDifficulty; } public double getScore() { return expScore; } }
public class Tester { public static void main(String[] args) throws IOException { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(bufferedReader.readLine().trim()); for(int test =0; test Expected Output Sample Output 0 Sample Input 1====================== -----TODAY'S PLAN----- ---------------------- Priority: Assignments:10 Completed:0 Hours Avail:0 Tot. Points:0.0
1 EasyCheesy 10 20 12 50 0
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started