Concept explainers
ShiftSupervisor Class
In a particular factory, a shift supervisor is a salaried employee who supervises a shift. In addition to a salary, the shift supervisor earns a yearly bonus when his or her shift meets production goals. Create a ShiftSupervisor class that is derived from the Employee class you created in
Want to see the full answer?
Check out a sample textbook solutionChapter 10 Solutions
Starting out with Visual C# (4th Edition)
Additional Engineering Textbook Solutions
Digital Fundamentals (11th Edition)
Programming in C
C++ How to Program (10th Edition)
Java: An Introduction to Problem Solving and Programming (7th Edition)
Software Engineering (10th Edition)
Starting Out with C++ from Control Structures to Objects (8th Edition)
- When working on this C++ assignment, focus on memorizing the syntax for writing classes. Write a simple class named Circle, with three private variables: doubles named x, y and radius. The center of the circle is denoted by coordinates (x,y), and the radius of the circle is denoted by radius. It should have public member functions with the following signatures: void setRadius(double r)void setX(double value)void setY(double value)double getRadius()double getX()double getY()double getArea()bool containsPoint(double xValue, double yValue) The first six member functions are straightforward functions to set and get the private member variables. double getArea() This member function should return the area of the circle. When you are calculating the area you can use 3.14 for pi. The formula is radius * radius * pi. bool containsPoint(double xValue, double yValue) This member function should return true if the point at (xValue, yValue) is contained in the circle, and false if not. You…arrow_forwardIn a particular factory a shift supervisor is a salaried employee who supervises a shift.In addition to a salary, the shift supervisor earns a yearly bonus when his or her shiftmeets production goals. Design a ShiftSupervisor class that is derived from theEmployee class you created in Programming Challenge 1. The ShiftSupervisor classshould have a member variable that holds the annual salary and a member variablethat holds the annual production bonus that a shift supervisor has earned. Write oneor more constructors and the appropriate accessor and mutator functions for the class.Demonstrate the class by writing a program that uses a ShiftSupervisor object.arrow_forwardWrite a C++ program. Define a class called HourlyEmployee that inherits the Employee Class provided. The class must have private attributes to store the total hours worked, the total regular hours worked (sum of hours ≤ 40), and the total overtime hours worked (sum of hours > 40).The class must also have member functions to perform the following tasks:• A constructor to initialize the first name, last name, and pay rate (See the Employee Class for more details).• A setter function to set the hours work for the month (by the week – assume 4 weeks in a month). Do not write separate setters for total regular and total overtime hours. Use a while/for loop that iterates four times to read the hours worked from the user and call the setter function four times. The header of the member function should look like this:void setTotalHoursWorked(double hoursWorked)• A getter function to return⬧ the total regular hours work for the month⬧ the total overtime hours for the month⬧ the monthly…arrow_forward
- Write a class named Coin . The Coin class should have the followingmember variable:A string named sideUp . The sideUp member variable will holdeither “heads” or “tails” indicating the side of the coin that isfacing up.The Coin class should have the following member functions:A default constructor that randomly determines the side of thecoin that is facing up (“heads” or “tails”) and initializes the sideUpmember variable accordingly.A void member function named toss that simulates the tossingof the coin. When the toss member function is called, itrandomly determines the side of the coin that is facing up(“heads” or “tails”) and sets the sideUp member variableaccordingly.A member function named getSideUp that returns the value ofthe sideUp member variable.Write a program that demonstrates the Coin class. The programshould create an instance of the class and display the side that isinitially facing up. Then, use a loop to toss the coin 20 times. Eachtime the coin is tossed, display the…arrow_forwardUsing C++ 11 Design a class called NumDays. The class’s purpose is to store a value that represents a number of work hours and converts it to a number of days. For example, 8 hours would be converted to 1 day. 12 hours would be converted to 1.5 days, and 18 hours would be converted to 2.25 days. The class should have a constructor that accepts a member of hours, as well as member functions for storing and retrieving the hours and days. The class should also have the following overloaded operators: + Addition operator. When two NumDays objects are added together, the overloaded + operator should return the sum of the two objects’ hours members. - Subtraction operator. When one NumDays object is subtracted from another, the overloaded – operator should return the difference of the two objects’ hours members. ++ Prefix and postfix increment operators. These operators should increment the number of hours stored in the object. When incremented, the number of days…arrow_forwardwritte in c++ Write a Circle class that has the following member variables: • radius : a double • pi : a double initialized with the value 3.14159 The class should have the following member functions: • Default Constructor. A default constructor that sets radius to 0.0. • Constructor. Accepts the radius of the circle as an argument. • setRadius. A mutator function for the radius variable. • getRadius. An accessor function for the radius variable. • getArea. Returns the area of the circle, which is calculated as area = pi * radius * radius • getCircumference. Returns the circumference of the circle, which is calculated as circumference = 2 * pi * radiusarrow_forward
- A class is made abstract by declaring that class virtual. T/Farrow_forwardc++ Define a class called Odometer that will be used to track fuel and mileage foran automotive vehicle. Include private member variables to track the milesdriven and the fuel efficiency of the vehicle in miles per gallon. The classshould have a constructor that initializes these values to zero. Include amember function to reset the odometer to zero miles, a member functionto set the fuel efficiency, a member function that accepts miles driven for atrip and adds it to the odometer’s total, and a member function that returnsthe number of gallons of gasoline that the vehicle has consumed since theodometer was last reset. Use your class with a test program that creates several tripswith different fuel efficiencies.arrow_forwardDesign an Account class used to represent an individual’s declining balance gift card. It contains a string for the account number, and a float value for the balance. It should include the following 7 functions: a 2-argument constructor (it accepts an account number and initial balance). a set function, one for each attribute (2 total functions, setAccount and setBalance. Each assigns an argument value to the named member variable. a get function for each attribute (2 total functions, getAccount, and getBalance). Each returns the value stored in the named member variable. a function to display the account’s information to the screen. The account number and balance value should be labelled. a function withdraw that takes a float argument and subtracts it from the balance. Write the class declaration. Member variables should NOT be accessible outside the class! Member functions should be accessible outside the class! Write the member function definitions for only the following…arrow_forward
- Create an Employee class that has properties for the following data: • Employee name • Employee number Next, create a class named ProductionWorker that is derived from the Employee class. The ProductionWorker class should have properties to hold the following data: • Shift number (an integer, such as 1, 2, or 3) • Hourly pay rate The workday is divided into two shifts: day and night. The Shift property will hold an integer value representing the shift that the employee works. The day shift is shift 1 and the night shift is shift 2. Create an application that creates an object of the ProductionWorker class and lets the user enter data for each of the object’s properties. Retrieve the object’s properties and display their values.arrow_forward"The program instantiates and uses instances of a derived class with default and parameterized constructors. Write A Base Class Declare a class named RealProperty that could be used to describe a piece of real property. It should contain these private fields: streetAddress (string) squareFootage (int) taxes (double) Each field should have a comment documenting what it is for. Add public member functions as follows: The default constructor. The default constructor initializes the fields so that the street address is an empty string and all numeric fields are 0 or 0.0. Implement the default constructor inline using the member initialization list syntax. The constructor that accepts these data: street address (string), square footage (int), and taxes (double). Implement this constructor inline using the member initialization list syntax and call the mutator function for square footage in the body of the constructor. Add mutator member functions to set the fields. One member function for…arrow_forwardIn order to extend a class, the new class should have access to all the data and inner workings of the parent class. True Falsearrow_forward
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
- Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage