Question: These are the directions, my current code, and the error.public class LabProgram { public static double calcToll ( int hour, boolean isMorning, boolean isWeekend )
These are the directions, my current code, and the error.public class LabProgram
public static double calcTollint hour, boolean isMorning, boolean isWeekend
Weekday toll rates
double beforeamWeekday ;
double fromamToamWeekday ;
double fromamTopmWeekday ;
double frompmTopmWeekday ;
double frompmWeekday ;
Weekend toll rates
double beforeamWeekend ;
double fromamTopmWeekend ;
double frompmWeekend ;
Check if it is a weekend
if isWeekend
if hour
return beforeamWeekend;
else if hour
return fromamTopmWeekend;
else
return frompmWeekend;
else It's a weekday
if hour
return beforeamWeekday;
else if hour
return fromamToamWeekday;
else if hour
return fromamTopmWeekday;
else if hour
return frompmTopmWeekday;
else
return frompmWeekday;
public static void mainString args
Test cases
System.out.printlncalcToll true, false; Should return
System.out.printlncalcToll false, false; Should return
System.out.printlncalcToll false, true; Should return
System.out.printlncalcToll true, true; Should return
System.out.printlncalcToll false, false; Should return
System.out.printlncalcToll false, false; Should return
System.out.printlncalcToll false, true; Should return
System.out.printlncalcToll false, true; Should return
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
