In a phrase Drone racing its a new sport of sorts where hobb

In a phrase: Drone racing it\'s a new \"sport\" of sorts where hobbyists create (3D print, laser cut etc.) tiny drones capable of reaching 60mph (or more1) for the purposes of racing through an obstacle course to make this even more sci-fi-y. the drones are typically outfitted with a camera that streams directly what it sees to either a monitor (e.g. TV screen) or an HMD (Head Mounted Display, ie. \"VR\" headsets). While it would be cool to write a working code to control such drones for racing purpose (moving in a 3-dimensional space, sending streaming video data to be viewed remotely. etc.) this exercise is a bit simpler and has more to do with keeping track of drone racing results (as you are only taking CSS 161 after all). Class Design: Drone (Suggested Time Spent:

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.

 In a phrase: Drone racing it\'s a new \
 In a phrase: Drone racing it\'s a new \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site