Answered step by step
Verified Expert Solution
Question
1 Approved Answer
What is wrong with my code that my test class output does not match the expected values? public class ShuttleBatteryMonitor { private int shortRate; private
What is wrong with my code that my test class output does not match the expected values?
public class ShuttleBatteryMonitor
private int shortRate;
private int shortLimit;
private int longRate;
private int chargeCapacity;
private int numPassengers;
private int currLocation;
private int chargeLevel;
private int numTrips;
private int totalChargeUsage;
public ShuttleBatteryMonitorint shortRate, int shortLimit, int longRate, int chargeCapacity
this.shortRate shortRate;
this.shortLimit shortLimit;
this.longRate longRate;
this.chargeCapacity chargeCapacity;
numPassengers ;
currLocation ;
chargeLevel chargeCapacity;
numTrips ;
totalChargeUsage ;
public void travelToint destination
travelToHelperdestination shortLimit, shortRate;
public void travelToint destination, int shortLimitOverride, int longRateOverride
travelToHelperdestination shortLimit, shortRate;
private void travelToHelperint destination, int shortLimitOverride, int longRateOverride
int distance Math.abscurrLocation destination;
currLocation destination;
int shortRateUsage numPassengers shortRate Math.minshortLimitOverride distance;
int longRateUsage numPassengers longRate Math.maxdistance shortLimitOverride, ;
int batteryUsageForCurrentTrip shortRateUsage longRateUsage;
chargeLevel batteryUsageForCurrentTrip;
numTrips;
totalChargeUsage batteryUsageForCurrentTrip;
public void recharge
currLocation ;
chargeLevel chargeCapacity;
public void loadPassengersint netAddedPassengers
numPassengers netAddedPassengers;
if numPassengers
numPassengers ;
public int getLocation
return currLocation;
public int getPassengerCount
return numPassengers;
public double getChargeRemaining
double remainingCharge double chargeLevel chargeCapacity;
remainingCharge int remainingCharge;
return remainingCharge; TODO: Replace this placeholder
public double getAverageUsagePerTrip
TODO: Your implementation goes here
if numTrips
return ; TODO: Replace this placeholder
return double totalChargeUsage numTrips;
public int getEstimatedTripsRemaining
if getAverageUsagePerTrip
return ; TODO: Replace this placeholder
return intchargeLevel getAverageUsagePerTrip;
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