
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.
this is a c++ program Define a class Money with two integer data members, dollars and cents. Member functions: Overload arithmetic operators (+ and -), and return new Money objects; Non-member functions: Overload comparison operators (<, >, !=, and ==), and return boolean values; Write a main function to test your code.
1. Define a class Rectangle with two attributes: (This is for C++) -length, an integer (default value 1) -width, an integer (default value 1) Provide the following member functions: -default constructor -constructor that takes parameters used to initialize the data -get/set function for each attribute -a function perimeter that returns the perimeter of the rectangle -a function area that returns the area of the rectangle b. Write a program that uses the class Rectangle to create two rectangle objects with...
c++ Define a derived class, ApartmentBuilding that contains four (4) data members: an integer named numFloors, an integer named unitsPerFloor, a boolean named hasElevator, and a boolean named hasCentralAir. There is a constructor containing parameters for the initialization of the above variables (in the same order as they appear above). There are also two functions: the first, getTotalUnits, accepts no parameters and returns the total number of units in the building; the second, isLuxuryBuilding accepts no parameters and returns true...
C++ In the code cell below, define a class named Student with an integer id and a string name. This class should have a constructor that takes two arguments: one for the id and the other for the name. Then Create another class named CollegeStudent that publicly inherits from Student. This class should have a protected member named major. It should also have a constructor that takes three arguments: id, name, and major. This constructor should delegate initializing the id...
Define a class Horse with two attributes, a string name and an integer numLegs. Write a two parameter constructor and a toString() method. *Write a class named Coll3 with a static method "updateName". There are three parameters to the method: a collection, an old name, and a new name. For every horse in the collection, if it has the same name as the parameter oldname, then replace the horse's name with the parameter new name. example: updateName({[X,4],[G,4],[X,3]}, X, Y) changes...
C++
Program 2 Consider a class Employee with data members: age (an integer), id (an integer) and salary (a float), and their corresponding member functions as follows: class Employee { private: int age; int id; float salary: public: Employee; // default constructor: age=0, id=0, and salary=0 void setAge(int x); // let age = x void setId(int x); // let id = x void setSalary(float x); // salary = x int getAge(); // return age int getId; // return id float...
Assume the existence of a class Arr with two (public) data members: a pointer to integer named arr_ptr, and an integer variable namedlength that will contain the number of elements in the array. Assume the variable a has been declared to be of type Arr, an array has been allocated and assigned to arr_ptr, and length has been assigned the proper value (i.e., the number of elements in the array). Write the code to add 1 to each element of...
C++ Define the class HotelRoom. The class has the following private data members: the room number (an integer) and daily rate (a double). Include a default constructor as well as a constructor with two parameters to initialize the room number and the room’s daily rate. The class should have get/set functions for all its private data members [3pts]. The constructors and the set functions must throw an invalid_argument exception if either one of the parameter values are negative. The exception...
Define a class for static Queue for storing integer numbers. Your class must include a constructor, a destructor, enqueue, dequeue, display, isFull, and isEmpty functions. Write a simple main function in your program that demonstrates the class
In C++ please! Thanks! Define a class Employee with data members as int employee_id – To store employee ID. String employee_name – To store the name of the employee. Define class Salary which inherits Employee class and has the following characteristics Data members String designation – To store employee designation. double monthly_salary – To store salary of the employee. Methods constructor Salary(int employee_id, String employee_name, String designation, double monthly_salary) – Invokes a superclass constructor and initialize data members. void display()...