Question: Please do in Java Provide code and screenshot Code Provided: class CabServiceProvider{ //Implement your code here } class Driver { private String driverName; private float

Please do in Java

Provide code and screenshot Please do in Java Provide code and screenshot Code Provided: class CabServiceProvider{

//Implement your code here } class Driver { private String driverName; private

float averageRating; public Driver(String driverName, float averageRating){ this.driverName=driverName; this.averageRating=averageRating; } public String

getDriverName(){ return this.driverName; } public void setDriverName(String driverName){ this.driverName=driverName; } public float

Code Provided:

class CabServiceProvider{

//Implement your code here

}

class Driver {

private String driverName;

private float averageRating;

public Driver(String driverName, float averageRating){

this.driverName=driverName;

this.averageRating=averageRating;

}

public String getDriverName(){

return this.driverName;

}

public void setDriverName(String driverName){

this.driverName=driverName;

}

public float getAverageRating(){

return this.averageRating;

}

public void setAverageRating(float averageRating){

this.averageRating=averageRating;

}

//DO NOT MODIFY THE METHOD

//Your exercise might not be verified if the below method is modified

public String toString(){

return "Driver driverName: "+this.driverName+" averageRating: "+this.averageRating;

}

}

class Tester {

public static void main(String args[]){

CabServiceProvider cabServiceProvider1 = new CabServiceProvider("Halo", 50);

Driver driver1 = new Driver("Luke", 4.8f);

Driver driver2 = new Driver("Mark", 4.2f);

Driver driver3 = new Driver("David", 3.9f);

Driver[] driversList = { driver1, driver2, driver3 };

for (Driver driver : driversList) {

System.out.println("Driver Name: "+driver.getDriverName());

double bonus = cabServiceProvider1.calculateRewardPrice(driver);

if (bonus>0)

System.out.println("Bonus: $"+bonus+" ");

else

System.out.println("Sorry, bonus is not available!");

}

//Create more objects of CabServiceProvider and Driver classes for testing your code

}

}

calculateRewardPrice(Driver driver) Calculate and return the bonus of the driver based on the below table. If averageRating of the driver is less than 4, return the bonus as 0. Cab Service Rating Reward Amount >-4.5 and =4 and =4.5 and =4 and

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!