Programming questions

Assignment Help C/C++ Programming
Reference no: EM13725913

Question 1: Derive a class Programmer from Employee. Supply a constructor Programmer(string name, double salary) that calls the base-class constructor. Supply a function get_name that returns the name in the format "Hacker, Harry (Programmer)".

Question 2: Implement a base class Person. Derive classes Student and Instructor from Person. A person has a name and a birthday. A student has a major, and an instructor has a salary. Write the class definitions, the constructors, and the member functions print() for all classes.

Question 3: Derive a class Manager from Employee. Add a data field, named department, of type string. Supply a function print that prints the manager's name, department, and salary. Derive a class Executive from Manager. Supply a function print that prints the string Executive, followed by the information stored in the Manager base object.

Question 4: Implement a base class Account and derived classes Savings and Checking. In the base class, supply member functions deposit and withdraw. Provide a function daily_interest that computes and adds the daily interest. For calcula- tions, assume that every month has 30 days. Checking accounts yield interest of 3 percent monthly on balances over $1,000. Savings accounts yield interest of 6 per- cent on the entire balance. Write a driver program that makes a month's worth of deposits and withdrawals and calculates the interest every day.

Question 5: Measure the speed difference between a statically bound call and a dynamically bound call. Use the Time class to measure the time spent in one loop of virtual function calls and another loop of regular function calls.

Question 6: Write a base class Worker and derived classes HourlyWorker and SalariedWorker. Every worker has a name and a salary rate. Write a virtual function compute_pay(int hours) that computes the weekly pay for every worker. An hourly worker gets paid the hourly wage for the actual number of hours worked, if hours is at most 40. If the hourly worker worked more than 40 hours, the excess is paid at time and a half. The salaried worker gets paid the hourly wage for 40 hours, no mat- ter what the actual number of hours is.

Question 7: Implement a base class Appointment and derived classes Onetime, Daily, Weekly, and Monthly. An appointment has a description (for example, "see the den- tist") and a date and time. Write a virtual function occurs_on(int year, int month, int day) that checks whether the appointment occurs on that date. For example, for a monthly appointment, you must check whether the day of the month matches. Then fill a vector of Appointment* with a mixture of appointments. Have the user enter a date and print out all appointments that happen on that date.

Question 8: Improve the appointment book program of Exercise P8.7. Give the user the option to add new appointments. The user must specify the type of the appointment, the description, and the date and time.

Question 9: Improve the appointment book program of Exercises P8.7 and P8.8 by letting the user save the appointment data to a file and reload the data from a file. The saving part is straightforward: Make a virtual function save. Save out the type, description, date, and time. The loading part is not so easy. You must first determine the type of the appointment to be loaded, create an object of that type with its default constructor, and then call a virtual load function to load the remainder.

Question 10: Implement a base class Vehicle and derived classes Car and Truck. A vehicle has a position on the screen. Write virtual functions draw that draw cars and trucks as follows:
Car Truck
Then populate a vector of Vehicle* pointers with a mixture of cars and trucks, and draw all of them.

Question 11: Implement a base class Shape and derived classes Rectangle, Triangle, and Square. Derive Square from Rectangle. Supply virtual functions double area() and void plot(). Fill a vector of Shape* pointers with a mixture of the shapes, plot them all, and compute the total area.

Reference no: EM13725913

Questions Cloud

Prepare a presentation of product life cycle : Prepare a Presentation of Product Life Cycle- A cover slide, a slide that sets the theme and goals of the presentation
Explain cause-and-effect diagram : The cause-and-effect diagram is important in determining causes and effects of a problem. The cause-and-effect diagram is also known as the Ishikawa diagram, or the fishbone diagram.
Why or how might the price of energy not decline : What factors affect how quickly U.S. businesses will actually increase their consumption of renewable fuels versus other energy sources?
What about the video clips of dolores del rio : What about the video clips of Dolores del Rio, Anthony Quinn, Edward James Olmos and Cantinflas? How do you feel they contribute to the stereotypes of Mexicans in film or do you feel otherwise?
Programming questions : Derive a class Programmer from Employee. Supply a constructor Programmer(string name, double salary) that calls the base-class constructor. Supply a function get_name that returns the name in the format "Hacker, Harry (Programmer)".
Propose strategies for addressing risk : Provide a detailed description of each risk and propose strategies for addressing each risk.
Organizational buyer behavior : Organizational Buyer Behavior: Marketing to organizations is significantly different from marketing to the consumer. This discussion will focus on issues such as derived demand
Pursuing a triple aim : Genesys Health System currently pursuing a Triple Aim and what are they doing, the capital cost, and patient experience and outcome
Assignment on widgecorp''s national sales : Prepare a presentation of 5-6 slides of your major findings. You may group a category of data from the Total United States and zip code 60614, and create a graph to show how they differ. The presentation should have at least one graph and a headli..

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Calculate the balance by adding deposits

Display the new balance in a ReadOnly text box or a label. Calculate the balance by adding deposits and subtracting service charges and checks. Include buttons for Calculate, Clear, and Exit.

  Perform operations on arrays

Perform operations on arrays execute tests and repetitions

  Write a method, to be included in a template unsorted list

Write a metho, to be included in a template unsorted list class, called replace_item, that will receive two xType parameters, one called olditem, the other called newitem.

  Calculate the volume flow rate in cubic feet

Write a program to calculate the volume flow rate in cubic feet per second of water flowing through a pipe of diameter d in inches and a velocity of v feet per second. The formula for the flow rate is given by: Where area = ?d^2 / 4 equation in sq..

  Create a 1-dimensional (1d) array

Write a program to create a 1-dimensional (1D) array that contains 15 characters and display to the screen a count of the occurrences of each of the vowels a, e, i, o, and u in the array.

  Smallest sequence of numbers in the array

Write a function called sum_smallest_sequence() that accepts an array of  signed  integers and the  number  of items in the array as arguments, and returns the sum of the smallest sequence of numbers in the array.

  The westfield carpet company has asked you to write an

the westfield carpet company has asked you to write an application that calculates the price of carpeting for

  You are to add mean, standard deviation

You are to add mean, standard deviation, and insert in order functionality to your statistics list program. Insert in order means that you will add a function called find_index that will locate the place in the array that a new value should be ins..

  Matching program that takes input from a text file

need to make a string matching program that takes input from a text file and outputs that match (if there is one) asked from the user. i have done this part , the only problem is that , with the output match , i also need to print some words before a..

  Draws a single level for a "rogue­like" computer game

You will write a program that draws a single level for a "Rogue­like" computer game. The program will parse a line of input text from an input file (room.txt), use the parsed text to determine the shape of the room and its contents and then draw the ..

  Three or more dimensions

What kind of program, or problem, might necessitate arrays of three or more dimensions?

  Compute and display net weekly pay

You need to prepare a C++ program in which you declare variables that holds an hourly wage, a number of hours worked, and a withholding percentage.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd