Question

(project 4)Write a class for an airplane class with constructors, interface (mutators and accessors)and a test...

(project 4)Write a class for an airplane class with constructors, interface (mutators and accessors)and a test driver (main). It should be able to change altitude (up,down) and speed.

The default constructor will set the altitude to 0 and speed to zero and longitude and latitude

to Boston, Massachusetts (42.3631 degrees N, 71.0064 degrees W). The overloaded constructor will set longitude and latitude to Louis Armstrong (29.9933 degrees N, 90.2581 degrees W) by passing that string to the Airplane object when it is created. If the altutude ever falls below 0 the change altutude function should announce the plane had crashed and the program exit as in the previous project. All mutators and constructor should check input for >= 0 ( no negative speeds or altitudes).

(project 5)(read the above first)

Add an external boolean equals() function that takes in two objects and returns true if they have same latlong and altitude. Write code to test it that announces a crash it equal.

Add external equalsto()function that takes in two objects and returns true if they have same latlong and altitude. The equalsto() functions is a friend function and has direct access to altitude and latlong. The objects are pass-by-reference. Write the most efficient function you can (change to pass by reference?).

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
(project 4)Write a class for an airplane class with constructors, interface (mutators and accessors)and a test...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • Q1. Write a C++ class called Time24h that describes a time of the day in hours,...

    Q1. Write a C++ class called Time24h that describes a time of the day in hours, minutes, and seconds. It should contain the following methods: • Three overloaded constructors (one of which must include a seconds value). Each constructor should test that the values passed to the constructor are valid; otherwise, it should set the time to be midnight. A display() method to display the time in the format hh:mm:ss. (Note: the time can be displayed as 17:4:34, i.e. leading...

  • Please write in dr java Here is the driver: import java.util.*; public class SquareDriver { public...

    Please write in dr java Here is the driver: import java.util.*; public class SquareDriver { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); String input =""; System.out.println("Welcome to the easy square program"); while(true) { System.out.println("Enter the length of the side of a square or enter QUIT to quit"); try { input = keyboard.nextLine(); if(input.equalsIgnoreCase("quit")) break; int length = Integer.parseInt(input); Square s = new Square(); s.setLength(length); s.draw(); System.out.println("The area is "+s.getArea()); System.out.println("The perimeter is "+s.getPerimeter()); } catch(DimensionException e)...

  • Design and implement a C++ class called Date that has the following private member variables month...

    Design and implement a C++ class called Date that has the following private member variables month (int) day (nt) . year (int Add the following public member functions to the class. Default Constructor with all default parameters: The constructors should use the values of the month, day, and year arguments passed by the client program to set the month, day, and year member variables. The constructor should check if the values of the parameters are valid (that is day is...

  • The class Engineer Test below is used to test two other class named Project & Engineer....

    The class Engineer Test below is used to test two other class named Project & Engineer. A project has three attributes: projNo (int), projName (string), revenue (double). Add a parameterized constructor, and setters & getters for all attributes. An engineer has four attributes: jobld (int), name (string), rate (double), and a list of projects. For each project, the engineer has a specific amount as profit (project revenue rate). Add a constructor that initializes the attributes: jobild, name and rate. Implement...

  • Making a rectangle class in java write a simple class that will represent a rectangle. Later...

    Making a rectangle class in java write a simple class that will represent a rectangle. Later on, we will see how to do this with graphics, but for now, we will just have to use our imaginations for the visual representations ofWthe rectangles. Instance Variables Recall that an object is constructed using a class as its blueprint. So, think about an rectangle on your monitor screen. To actually draw a rectangle on your monitor screen, we need a number of...

  • I need this in c++ please Write a Map class that is composed of a Location...

    I need this in c++ please Write a Map class that is composed of a Location class. Location class has three private variable string nameOfCity, double variables, latitude and longitude. It has a constructor to initialize these and also the usual getters. It has three functions: string toString() which prints :double getFlyingTime(Location l) which returns the flying time between this and location l. It uses the formula that time = distance/speed. speed = 673 miles/hour. No need to convert to...

  • Antique Class Each Antique object being sold by a Merchant and will have the following attributes:...

    Antique Class Each Antique object being sold by a Merchant and will have the following attributes: name (string) price (float) And will have the following member functions: mutators (setName, setPrice) accessors (getName, getPrice) default constructor that sets name to "" (blank string) and price to 0 when a new Antique object is created a function toString that returns a string with the antique information in the following format <Antique.name>: $<price.2digits> Merchant Class A Merchant class will be able to hold...

  • Student class: Instance variables name id Constructors: Default constructor Constructor that has id and name passed...

    Student class: Instance variables name id Constructors: Default constructor Constructor that has id and name passed to the constructor Methods: Accessors int getID( ) String getName( ) Class Roster: This class will implement the functionality of all roster for school. Instance Variables a final int MAX_NUM representing the maximum number of students allowed on the roster an ArrayList storing students Constructors a default constructor should initialize the list to empty strings a single parameter constructor that takes an ArrayList<Student> Both...

  • C++ Lab 9A Inheritance Employee Class Create a project C2010Lab9a; add a source file Lab9a.cpp to...

    C++ Lab 9A Inheritance Employee Class Create a project C2010Lab9a; add a source file Lab9a.cpp to the project. Copy and paste the code is listed below: Design a class named Employee. The class should keep the following information in member variables: Employee name Employee number Hire date // Specification file for the Employee class #ifndef EMPLOYEE_H #define EMPLOYEE_H #include <string> using namespace std; class Employee { private:        // Declare the Employee name string variable here. // Declare the Employee...

  • USING BLUEJ: You will write from scratch a class called Heater that represents an adjustable thermostat....

    USING BLUEJ: You will write from scratch a class called Heater that represents an adjustable thermostat. Follow the detailed steps below. This is based on Exercises 2.93 - 2.94 (6e) / 2.92 - 2.93 (5e) in the book, but with slight modifications, so be sure to follow the instructions below. Create a new BlueJ project named LastName-heater using your last name. Create a class named Heater At the top of the source code for Heater, add documentation like this: /**...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT