Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Why is my code not passing the test case: i am getting 56.498661951556755 instead of 56.5 can you fix it for me - code is

Why is my code not passing the test case:

i am getting 56.498661951556755 instead of 56.5 can you fix it for me - code is below

1 EasyCheesy 10 20 12 50 3 A_Wha_Dis??? 2 2 1 Sas_Crise_Mi_A_Ded!!! 3 3 1 Ow_Im_Suh_Wikid?!?! 4 2 5

Your Output (stdout)

====================== -----TODAY'S PLAN----- ---------------------- Priority:Ow_Im_Suh_Wikid?!?! Assignments:13 Complete:23 Hours Aval:3 Tot. Points:56.498661951556755 

Expected Output

====================== -----TODAY'S PLAN----- ---------------------- Priority:Ow_Im_Suh_Wikid?!?! Assignments:13 Completed:23 Hours Avail:3 Tot. Points:56.5

class AssignPlan { //decalre the private variables private String highPriorityItem=""; private int numAssignment,numComplete,hoursAvailable; private double totalPoints;

//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; }

//ToString method for the display ouput public String toString() { return"====================== "+ "-----TODAY'S PLAN----- "+ "---------------------- "+ "Priority:"+gethighPriorityItem()+" "+ "Assignments:"+getnumAssignment()+" "+ "Complete:"+getnumComplete()+" "+ "Hours Aval:"+gethoursAvailable()+" "+ "Tot. Points:"+gettotalPoints()+" "; }

//constructors public AssignPlan() {

}

public AssignPlan(int numAssigns) { numAssignment=numAssigns; } //contructor public AssignPlan(String highPriorityItem,int numAssigns,int numComplete,int hoursAvailable,double totalPoints) { this.highPriorityItem=highPriorityItem; this.numAssignment=numAssigns; this.numComplete=numComplete; this.hoursAvailable=hoursAvailable; this.totalPoints=totalPoints; } //set the priority value public void setPriorityTo(String aname) { this.highPriorityItem=aname; } //method of the handle Assignmet public void handleUrgentAssignment(String name,int efforts,int resources, int difficulty) { Assignment newAssignment=new Assignment(name,efforts,resources,difficulty); this.highPriorityItem=name; this.numAssignment=this.numAssignment+1; this.numComplete=this.numComplete+1; this.hoursAvailable=this.hoursAvailable-efforts; this. totalPoints=this.totalPoints+newAssignment.getScore(); } }

class Assignment { private String name; private int efforts; private int numResources; private int estDifficulty; private double estScore;

//constructor

public Assignment(String name,int efforts,int numResources,int estDifficulty) { this.name=name; this.efforts=efforts; this.numResources=numResources; this.estDifficulty=estDifficulty; this.estScore=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 estScore; } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Autonomous Database In Enterprise Architecture

Authors: Bal Mukund Sharma, Krishnakumar KM, Rashmi Panda

1st Edition

1801072248, 978-1801072243

More Books

Students also viewed these Databases questions