What will the following
#include <iostream>
using namespace std;
class Sky
{
public:
Sky ()
{ cout ≪ “Entering the sky.\n"; }
∼Sky()
{ cout ≪ "Leaving the sky.\n"; }
};
class Ground : public Sky
{
public:
Ground()
{ cout ≪ "Entering the Ground.\n"; }
∼Ground()
{ cout ≪ "Leaving the Ground.\n"; }
int main()
{
}
Ground object;
return 0;
Want to see the full answer?
Check out a sample textbook solutionChapter 15 Solutions
Starting Out With C++ From Control Structures Through Objects, Student Value Edition (8th Edition)
Additional Engineering Textbook Solutions
Concepts Of Programming Languages
Introduction To Programming Using Visual Basic (11th Edition)
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Starting Out With Visual Basic (7th Edition)
Java How To Program (Early Objects)
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
- Subject: Java Programming Hi Expert Sir, this (A, B) is one question...... please read and solve it carefully. and Don't submit the wrong answer. It's very important to me.... thank you Write a program to calculate the midpoint of two 2D coordinate points. A) Among them, the Point class represents two-dimensional coordinate points and has private member variables x and y, representing the values of the abscissa and ordinate, initialized by the constructor. B) Four methods setX (), getX (), setY (), and getY () are used to set and obtain the coordinates. In addition, a member method midPoint (Point p), which takes a Point object as a parameter, calculates the midpoint of the two coordinates and returns a new two-dimensional point. It is required to reflect the encapsulation characteristics in the program. Instantiate two two-dimensional points (4, 5) and (6, 8) in the main function of the class Test. Calculate the midpoint of the two by calling the midPoint of one of them and return…arrow_forwardConsider te following declaration:enum fruitType (ORANGE, APPLE, BANANA, GRAPE, STRAWBERRY, MANGO GUAVA, PINEAPPLE, KIWI); fruitType fruit;a. What is the value of static_cast <int>(STRAWBERRY)?b. What is the value, if any, of the expresion?static_cast<fruitType>(static_cast<int>(MANGO) - 2) c. What is the value if any, of the expression?static_cast<fruitType>(static_cast<int>(GRAPE) + 2)d, What if the value, if any, of the expression: BANANA <= KIWIe. What is the output, if any, of the following code?for(fruit = BANANA,; fruit < PINEAPPLE; fruit++) cout << static_cast<int>(fruit) << ", "; cout << endl;arrow_forwardq ) Employee class is having three properties known as name, EmployeeID, address. Writea Java program to create class with two constructors one with no arguments, anotherwith three arguments.arrow_forward
- Write a Rational class. Recall a rational number is a rational number, composed of two integers with division indicated. The division is not carried out, it is only indicated, as in 1/2, 2/3, 15/32. You should represent rational numbers using two int values, numerator and denominator. #include <iostream> #include <string> #include <stdlib.h> using namespace std; class rational { public: /* default constructor set the rational number to 0, (i.e., numerator is 0, denominator is 1) */ rational(); /* Set the invoking object's value from user input */ void input(); /* Display invoking object's value in the standard output, in the form of numerator/denominator */ void output() const; //return the invoking object's numerator int get_numerator() const; //return the invoking object's denominator int get_denominator() const; // Set invoking object to be the sum of op1 and op2 void Add(const rational& op1, const rational& op2); // Set the invoking…arrow_forward2. Consider the following class, which represents a price in dollars and cents: class Price { private: int dollars; int cents; public: Price() { dollars = cents = 0; } Price(int d, int c) { dollars = d; cents = c; } Price operator+(Price&); void printer(); }; Implement the overloaded + operator to compute the sum of two Price objects, and return the result as a Price object containing the sum. You may assume that all price objects contain valid data, i.e. dollars>=0 and 0<=cents<=99.arrow_forwardThe following code may, or may not, work. However the bigger issue is that it doesn't give good information to the end user. Assume that there is a Circle class, like we've defined in class before. Fix what problems you see, that could affect naming conventions, capitalization, and data output, and make sure the data output is clean for the end user. cout << "For Circle 1:" << endl; cout << c1.getArea() << endl; cout << c1.getx() << " " << c1.gety() << endl; cout << c1.getcolor() << endl; cout << endl << endl; This is the full question and it is c++arrow_forward
- write the classes integerManipulationImp.cpp and primeFactorizationImp.cpp Write the definitions of the functions of the class primeFactorization (Example 11-4) declared in the primeFactorization header file. Write a program that uses this class to output the prime factorization of an integer. Your program should prompt the user for an integer, determine if the input is a prime number, and display the factorization of the integer. An example of the program is shown below: Enter an integer between 2 and 270,000,000,000,000: 1005427 1005427 is a prime number. Its factorization is: 1005427 = 1005427arrow_forwardDeclare Circle and Square classes with all relevant member functions and variables to determine area and circumference/perimeter. Write a function to calculate the shaded area shown in the graphics below. The user of the program must be required to enter the basic dimensions of both Square and Circle objects.arrow_forwardPlease written by Computer source Write the following program in C#. Use comments to indicate your mutator, accessors, and constructors. Write a program that includes an Employee class that can be used to calculate and print the take-home pay for a commissioned sales employee. All employees receive 7% of the total sales. Federal tax rate is 18%. Retirement contribution is 10%. Social Security tax rate is 6%. Write instance methods to calculate the commission income, federal and social security tax withholding amounts and the amount withheld for retirement. Use appropriate constants, design an object-oriented solution, and write constructors. Include at least one mutator and one accessor method; provide properties for the other instance variables. Create a second class to test your design. Allow the user to enter values for the name of the employee and the sales amount for the week in the second class.arrow_forward
- I want the below code modified that works for multi user in below code there are only one user but i need multi user up to 10? Code #include <iostream> #include <time.h> #include <conio.h> Using namespace std; class Bank {public:}; class ATMAccountHolders:Bank {string accountHolders; string accountHoldersAddress, branch; int accountNumber; double startBalance; double accountBalance; double amount; int count; Public: void deposit(); void withdraw(); void accountExit(); ATMAccountHolders() {accountNumber = 7787; accountHolders = " Ammad Naseer"; accountHoldersAddress = " House no.112"; startBalance = 6000.00; accountBalance = 6000.00; branch = " Islamabad"; amount = 20000; } }; void ATMAccountHolders::deposit() { system("cls"); cout<<" ATM ACCOUNT DEPOSIT SYSTEM "; cout<<"\n\nThe Names of the Account Holders are :"<<accountHolders<<"\n\n"; cout<<"\tThe Account Holders' address is…arrow_forwardTHIS IS FOR C# >>>>>>>>>>>>>>>>>>>>>>>>>THIS IS FOR C# Create a program named PaintingDemo that instantiates an array of eight Room objects and demonstrates the Room methods. The Room constructor requires parameters for length, width, and height fields (all of type int); use a variety of values when constructing the objects. The Room class also contains the following fields: Area - The wall area of the Room (as an int) Gallons - The number of gallons of paint needed to paint the room (as an int) Both of these values are computed by calling private methods. Include read-only properties to get a Room’s values. A room is assumed to have four walls, and you do not need to allow for windows and doors, and you do not need to allow for painting the ceiling. A room requires one gallon of paint for every 350 square feet (plus an extra gallon for any square feet greater than 350). In other words, a 12 x 3 x 10 room with…arrow_forwardEach of the following class declarations or programs contain errors. Find as many as possible. 73. class Circle: { private double centerX; double centerY; double radius; public setCenter(double, double); setRadius(double); } 74. #include using namespace std; Class Moon; { Private; double earthWeight; double moonWeight; Public; moonWeight(double ew); { earthWeight = ew; moonWeight = earthWeight / 6; } double getMoonWeight(); { return moonWeight; } }arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education