Starting Out with C++ from Control Structures through Objects Brief, Student Value Edition (8th Edition)
bartleby

Videos

Textbook Question
100%
Book Icon
Chapter 13, Problem 2PC

Employee Class

Write a class named Employee that has the following member variables:

• name—a string that holds the employee’s name

• idNumber—a n int variable that holds the employee’s ID number

• department—a string that holds the name of the department where the employee works

• position—a string that holds the employee’s job title

The class should have the following constructors:

• A constructor that accepts the following values as arguments and assigns them to the appropriate member variables: employee’s name, employee’s ID number, department, and position.

• A constructor that accepts the following values as arguments and assigns them to the appropriate member variables: employee’s name and ID number. The department and position fields should be assigned an empty string ("").

• A default constructor that assigns empty strings ("") to the name, department, and position member variables, and 0 to the idNumber member variable.

Write appropriate mutator functions that store values in these member variables and accessor functions that return the values in these member variables. Once you have written the class, write a separate program that creates three Employee objects to hold the following data:

Chapter 13, Problem 2PC, Employee Class Write a class named Employee that has the following member variables:  namea string

The program should store this data in the three objects and then display the data for each employee on the screen.

Blurred answer
Students have asked these similar questions
Employee Class (Medium)     Write a class named Employee that has the following member variables: name. A string that holds the employee’s name. idNumber. An int variable that holds the employee’s ID number. department. A string that holds the name of the department where the employee works. position. A string that holds the employee’s job title. The class should have the following constructors: A constructor that accepts the following values as arguments and assigns them to the appropriate member variables: employee’s name, employee’s ID number, department, and position. A constructor that accepts the following values as arguments and assigns them to the appropriate member variables: employee’s name and ID number. The department and position fields should be assigned an empty string (""). A default constructor that assigns empty strings ("") to the name, department, and position member variables, and 0 to the idNumber member variable. Write appropriate mutator functions that…
Movie Information   Write a class named MovieInfo that holds data about movie. The class should have the following member variables: title: hold movie’s name category: hold movie’s category year: hold released year mins: hold running time in mins. Write a constructor that accepts arguments for each member variable, appropriate mutator functions that store values in these member variables, and accessor functions that return the values in theses member variables. Once you have written the class, write a separate program that creates four MovieInfo objects and stores the following data in them. Here is the information of four MovieInfo objects: moive1, moive2, moive3, moive4   movie1 title The Book of Life category Animation |Adventure | Comedy year 2014 mins 95     moive2 title Roman Holiday category Comedy | Drama | Romance year 1953 mins 118     movie3 title Kung Fu Panda category Animation | Action…
(Invoice Class) Create a class called Invoice that a hardware store might use to representan invoice for an item sold at the store. An Invoice should include four data members—a part number (type string), a part description (type string), a quantity of the item being purchased (typeint) and a price per item (type int). Your class should have a constructor that initializes the fourdata members. A constructor that receives multiple arguments is defined with the form:ClassName( TypeName1 parameterName1, TypeName2 parameterName2, ... )Provide a set and a get function for each data member. In addition, provide a member functionnamed getInvoiceAmount that calculates the invoice amount (i.e., multiplies the quantity by theprice per item), then returns the amount as an int value. If the quantity is not positive, it should beset to 0. If the price per item is not positive, it should be set to 0. Write a test program that demonstrates class Invoice’s capabilities

Chapter 13 Solutions

Starting Out with C++ from Control Structures through Objects Brief, Student Value Edition (8th Edition)

Ch. 13.6 - What is an inline member function?Ch. 13.9 - Briefly describe the purpose of a constructor.Ch. 13.9 - Prob. 13.13CPCh. 13.9 - A member function that is never declared with a...Ch. 13.9 - A member function that is never declared with a...Ch. 13.9 - Prob. 13.16CPCh. 13.9 - A constructor that requires no arguments is called...Ch. 13.9 - True or False: Constructors are never declared...Ch. 13.9 - True or False: Destructors are never declared with...Ch. 13.9 - Prob. 13.20CPCh. 13.12 - What will the following program display on the...Ch. 13.12 - What will the following program display on the...Ch. 13.12 - In your answer for Checkpoint 13.22, indicate for...Ch. 13.12 - Why would a member function be declared private?Ch. 13.12 - Define an array of three InventoryItem objects.Ch. 13.12 - Complete the following program so it defines an...Ch. 13.17 - Prob. 13.27CPCh. 13.17 - When designing an object-oriented application, who...Ch. 13.17 - How do you identify the potential classes in a...Ch. 13.17 - What are a classs responsibilities?Ch. 13.17 - What two questions should you ask to determine a...Ch. 13.17 - Will all of a classs actions always be directly...Ch. 13.17 - Look at the following description of a problem...Ch. 13 - What is the difference between a class and an...Ch. 13 - What is the difference between the following...Ch. 13 - What is the default access specification of class...Ch. 13 - Look at the following function header for a member...Ch. 13 - A contractor uses a blueprint to build a set of...Ch. 13 - What is a mutator function? What is an accessor...Ch. 13 - Is it a good idea to make member variables...Ch. 13 - Can you think of a good reason to avoid writing...Ch. 13 - Under what circumstances should a member function...Ch. 13 - What is a constructor? What is a destructor?Ch. 13 - What is a default constructor? Is it possible to...Ch. 13 - Is it possible to have more than one constructor?...Ch. 13 - If a class object is dynamically allocated in...Ch. 13 - When defining an array of class objects, how do...Ch. 13 - What are a classs responsibilities?Ch. 13 - How do you identify the classes in a problem...Ch. 13 - Programming: In programming, there are two most...Ch. 13 - ____________ programming is centered around...Ch. 13 - _________ programming is centered around objects.Ch. 13 - _____________ is an objects ability to contain and...Ch. 13 - In C++, the _________ is the construct primarily...Ch. 13 - A class is very similar to a(n) _____________.Ch. 13 - A(n) _________ is a key word inside a class...Ch. 13 - The default access specification of class members...Ch. 13 - The default access specification of a struct in...Ch. 13 - Defining a class object is often called the...Ch. 13 - Members of a class object may be accessed through...Ch. 13 - If you were writing the declaration of a class...Ch. 13 - If you were writing the external definitions of...Ch. 13 - When a member functions body is written inside a...Ch. 13 - A(n) __________ is automatically called when an...Ch. 13 - A(n) __________ is a member function with the same...Ch. 13 - __________ are useful for performing...Ch. 13 - Constructors cannot have a(n) _________ type.Ch. 13 - A(n) ___________ constructor is one that requires...Ch. 13 - A(n) ___________ is a member function that is...Ch. 13 - A destructor has the same name as the class, but...Ch. 13 - Like constructors, destructors cannot have a(n)...Ch. 13 - A constructor whose arguments all have default...Ch. 13 - A class may have more than one constructor, as...Ch. 13 - Prob. 41RQECh. 13 - A(n) __________ may be used to pass arguments to...Ch. 13 - Write a class declaration named Circle with a...Ch. 13 - Add a default: constructor to the Circle class in...Ch. 13 - Add an overloaded constructor to the Circle class...Ch. 13 - Write a statement that defines an array of five...Ch. 13 - Write a statement that defines an array of five...Ch. 13 - Prob. 48RQECh. 13 - If the items on the following list appeared in a...Ch. 13 - Look at the following description of a problem...Ch. 13 - T F Private members must be declared before public...Ch. 13 - T F Class members are private by default.Ch. 13 - T F Members of a struct are private by default.Ch. 13 - T F Classes and structures in C++ are very...Ch. 13 - T F All private members of a class must be...Ch. 13 - T F All public members of a class must be declared...Ch. 13 - T F It is legal to define a pointer to a class...Ch. 13 - T F You can use the new operator to dynamically...Ch. 13 - T F A private member function may be called from a...Ch. 13 - T F Constructors do not have to have the same name...Ch. 13 - T F Constructors may not have a return type.Ch. 13 - T F Constructors cannot take arguments.Ch. 13 - T F Destructors cannot take arguments.Ch. 13 - T F Destructors may return a value.Ch. 13 - T F Constructors may have default arguments.Ch. 13 - T F Member functions may be overloaded.Ch. 13 - T F Constructors may not be overloaded.Ch. 13 - T FA class may not have a constructor with no...Ch. 13 - T F A class may only have one destructor.Ch. 13 - T F When an array of objects is defined, the...Ch. 13 - T F To find the classes needed for an...Ch. 13 - T F A classs responsibilities are the things the...Ch. 13 - class Circle: { private double centerX; double...Ch. 13 - #include iostream using namespace std; Class Moon;...Ch. 13 - #inc1ude iostream using namespace std; class...Ch. 13 - class Change { public: int pennies; int nickels;...Ch. 13 - Date Design a class called Date. The class should...Ch. 13 - Employee Class Write a class named Employee that...Ch. 13 - Car Class Write a class named Car that has the...Ch. 13 - Prob. 4PCCh. 13 - Retail Item Class Write a class named RetailItem...Ch. 13 - Inventor Class Design an Inventory class that can...Ch. 13 - TestScores Class Design a TestScores class that...Ch. 13 - Circle Class Write a Circle class that has the...Ch. 13 - Population In a population, the birth rate and...Ch. 13 - Number Array Class Design a class that has an...Ch. 13 - Payroll Class Design a PayRoll class that has data...Ch. 13 - Coin Toss Simulator Write a class named Coin. The...Ch. 13 - Tossing Coins for a Dollar For this assignment,...Ch. 13 - Fishing Game Simulation For this assignment, you...Ch. 13 - Mortgage Payment Design a class that will...Ch. 13 - Freezing and Boiling Points The following table...Ch. 13 - Cash Register Design a CashRegister class that can...Ch. 13 - A Game of 21 For this assignment, you will write a...Ch. 13 - Trivia Game In this programming challenge, you...Ch. 13 - Patient Fees 1. This program should be designed...
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
  • Text book image
    Microsoft Visual C#
    Computer Science
    ISBN:9781337102100
    Author:Joyce, Farrell.
    Publisher:Cengage Learning,
    Text book image
    EBK JAVA PROGRAMMING
    Computer Science
    ISBN:9781337671385
    Author:FARRELL
    Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
C++ Data Members; Author: CppNuts;https://www.youtube.com/watch?v=StlsYRNnWaE;License: Standard YouTube License, CC-BY