In a phrase Drone racing its a new sport of sorts where hobb
Solution
Code for Drone class :
abstract class Drone
{
private string name;
private double[] timearray;
public void getter(string name)
{
this.name = name;
}
public string setter()
{
return name;
}
public Drone()
{
name = \'Racing Drone\';
timearray = new double(10){-1};
}
public Drone(string name)
{
this.name = name;
timearray = new double(10){-1};
}
public void addCheckPoint(double time)
{
if(isRaceCompleted())
System.out.println(\"Race already completed with 10 checkpoints\");
else
{
for(int i=0; i<10; i++)
if(timearray[i] == -1)
{
timearray[i] = time;
break;
}
}
}
public boolean isRaceCompleted()
{
for(int i=0; i<10; i++)
if(timearray[i] == -1)
return false;
return true;
}
public double getCompletedTime()
{
double total = 0;
if(isRaceCompleted())
{
for(int i=0; i<10; i++)
total += timearray[i];
return total;
}
else
return -1;
}
}
As the class is abstract no output could be provided.

