Is the following
void showEmployeeData(const Employee object); int main( ) { HourlyEmployee joe("Mighty Joe", "123-45-6789", 20.50, 40); SalariedEmployee boss("Mr. Big Shot", "987-65-4321", 10500.50); showEmployeeData(joe); showEmployeeData(boss); return 0; } void showEmployeeData(const Employee object) { cout << "Name: " << object.getName( ) << endl; cout << "Social Security Number: " << object.getSSN( ) << endl; } |
Want to see the full answer?
Check out a sample textbook solutionChapter 15 Solutions
Problem Solving with C++ (10th Edition)
Additional Engineering Textbook Solutions
Starting Out with Java: Early Objects (6th Edition)
C++ How to Program (10th Edition)
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
Software Engineering (10th Edition)
Absolute Java (6th Edition)
Starting out with Visual C# (4th Edition)
- PROGRAMMING LANGUAGE: C++ I need the code for clockType.h , clockTypelmp.cpp , main.cpp CLOCKTYPE.H code provided in this exercise [EVALUATE THE GIVEN CODE AND PROVIDE THE CORRECT CODE] class clockType { public: void setTime(int, int, int); void getTime(int&, int&, int&) const; void printTime() const; void incrementSeconds(); void incrementMinutes(); void incrementHours(); bool equalTime(const clockType&) const; private: int hr; int min; int sec; };arrow_forwardPlease type and execute a java program and display output of the program that fulfills the following function as soon as possible. Demonstrate the use of overloaded constructors Three constructors each initialize two variables Three methods, 1 computes the radius of a circle, 1 computes the area of a rectangle, and area of spherearrow_forwardIs the following program legal? The relevant classes are defined in Displays 7.2,7.3, and 7.5.public class EmployeeDemo{public static void main(String[] args){HourlyEmployee joe =new HourlyEmployee("Joe Young",new Date("February", 1, 2015), 10.50, 40);SalariedEmployee boss =new SalariedEmployee("Mr. Big Shot",new Date("January", 1, 2015), 100000);printName(joe);printName(boss);}public void printName(Employee object){System.out.println(object.getName());}}arrow_forward
- ABC Bank announced a new scheme of reward points for a transaction using an ATM card. Each transaction using the normal card will be provided by giving a reward percentage of the transaction amount as a reward point. If a transaction is made using a premium card and it is for fuel expenses, additional 10 points will be rewarded. Write a program to calculate the total reward points.Strictly adhere to the Object-Oriented specifications given in the problem statement. All class names, member variable names, and function names should be the same as specified in the problem statement.A class VISACard has the following attributes. Access Specifiers Data type Variable protected string type protected double amount private int rewardPercentage Include the following method in VISACard class. Method Description public void ComputeRewardPoints() In this method, calculate and display the reward pointsbased on rewardPercentage in amount Formula:Reward points = amount *…arrow_forwardNeed help in this question Consider the following skeletal C program:void fun1(void); /* prototype */void fun2(void); /* prototype */void fun3(void); /* prototype */void main() {int a, b, c;. . .}void fun1(void) {int b, c, d;. . .}void fun2(void) {int c, d, e;. . .}void fun3(void) {int d, e, f;. . .}Given the following calling sequences and assuming that dynamic scopingis used, what variables are visible during execution of the last functioncalled? Include with each visible variable the name of the function inwhich it was defined.a. main calls fun1; fun1 calls fun2; fun2 calls fun3.b. main calls fun1; fun1 calls fun3.c. main calls fun2; fun2 calls fun3; fun3 calls funarrow_forwardPlease fill in the blanks for the following statements: To define a class use the keyword ________________ followed by the name of the class.arrow_forward
- Consider the following program in C-like syntax:void f1();void f2();int main(){int x, y;...}int f1()int a, b, x;...}int f2(){int b, c, x, y;...} If the programming language uses dynamic scoping, what are the variables that arevisible in the last function in the following call sequences? Give not only the names ofthe variables, but also where they are declared.(a) main → f1 → f2(b) main → f2 → f1arrow_forwardIn C++, write declarations to declare each variable to have the specified type and initial value: Problem: numberOfDeposits and numberOfChecks to be of type int, each with an initial value of 0; totalDeposits and totalChecks to be of type double, each with an initial value of 0.0; and serviceCharge to be of type double with an initial value of 0.25arrow_forwardWrite a C++ program to check for the not-eligible donor by throwing a custom exception.Strictly adhere to the Object-Oriented specifications given in the problem statement. All class names, member variable names, and function names should be the same as specified in the problem statement. The class Donor has the following protected variables. Data Type Variable string name int age int weight string bloodGroup In the Donor class, define the following function. Method Description bool validateDonor(Donor donor) This method validates donor eligibility. Validate the donor details with the following conditions. 1.Age must be greater than 30 then the donor is eligible. 2.If the age is less than 30 then throw an exception and check the weight should be greater than 44 kg in catch block, If the weight is also less than 44 then the donor is not eligible and rethrow the exception to the main method. If the weight is greater than 44 then the donor is eligible. In the…arrow_forward
- Kindly Solve this C++ question as per the instructions. Thank you for your help! Instructions: 1- Put the class definition in Flight.h and the implementation of the constructors and functions in Flight.cpp Implement the Flight.h and Flight.cpp so that class Flight contains: 4 private instance variables: Name of data type string, which describe the three electric vehicle charger types (AC975, DL521, and AC863). Destination of data type string that shows the final destination of that flight. Hour and Minute of data type int that show the departure time. A default constructor which sets all of the numeric instance variables to zero and the String instance variables to null. A constructor with 4 parameters that sets the 4 instance variables to the corresponding values passed. Implement an accessor method for each information (Flight name, Flight destination, and Flight Time) that will return the value of the instance variable. For example, the getX() method for the instance variables…arrow_forwardIs the following program legal? The relevant classes are defined in Displays 7.2and 7.3.public class EmployeeDemo{public static void main(String[] args){HourlyEmployee joe =new HourlyEmployee("Joe Young",new Date("Feb", 1, 2015), 10.50, 40);String nameNDate = joe.super.toString();System.out.println(nameNDate);}}arrow_forwardAssume that you are applying “testing” and “inspection”, the two defect finding methods in the following buggy code example to find defects. Explain how “testing” and “inspection” differ in finding defects quickly and the efforts required for the example. public class Employee { private String id; private int name; private double salary; public Employee(String id,int name,double salary) { } public Employee() { } } Public class Customer { public static void main(String s[]) { Employee e1=new Employee(“10060OTU”, “S1”, 2000.50); Employee e2=new Employee(); System.out.println (“The salary of Employee S1 is”+ e1.salary); }arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning