C++ PROGRAMMING: PROGRAM DESIGN INCLUDIN
8th Edition
ISBN: 9780357425312
Author: Malik
Publisher: Cengage
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 10, Problem 9SA
Consider the definition of the class product Type as given in Exercise 8. Which function members are accessors and which are mutators? (4)
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
This is object oriented programming
Language is C++
Consider the following scenario of a class Person. A Person class has a Name, ID, Address and has functions of change the address and profile display. (Hint: Composition is not applied)
Two classes are derived from this class person. 1) Student 2) Employee.
The student class has a course number, classes attended, year (freshman=1, sophomore=2 and so on), and functions to change course and profile display.
The employee class has a Date of joining and date of promotion.
The employee class further has two child classes 1) Faculty 2) Admin.
Faculty class has a course number, classes taught, Rank (AP, lecturer etc) and a function to display profile.
Admin class has number of projects worked on and a display profile function.
Answer the questions based on this scenario.
Make the classes as mentioned above. Make appropriate constructors and functions. Choose access type wisely.
1. Fill in the blanks for Questions 1 & 2
a. Instance of a class is called
b.
functions have same name but different sets of parameters.
of arguments in a function call must match
c. Number,
the parameters in function parameter list
and
d.
functions are defined once and can be used for different data
Тypes.
2. Most important attributes of OOP (Object Oriented Programming) are:
_ , that is creating new classes from an existing base class.
when a program calls a virtual function using base class
b.
pointers or references to use the same function with different
forms/structures.
(b) How does the static data member of a class differ from a non-static data member? Give a real-world
scenario in which a static data member might be useful.
Chapter 10 Solutions
C++ PROGRAMMING: PROGRAM DESIGN INCLUDIN
Ch. 10 - Mark the following statements as true or false....Ch. 10 - Find the syntax errors in the following class...Ch. 10 - Find the syntax errors in the following class...Ch. 10 -
Find the syntax errors in the following class...Ch. 10 -
Find the syntax errors in the following class...Ch. 10 - Prob. 6SACh. 10 - Assume the definition of class foodType as given...Ch. 10 -
Consider the definition of the following class:...Ch. 10 - Consider the definition of the class product Type...Ch. 10 -
Consider the definition of the class product Type...
Ch. 10 - Prob. 11SACh. 10 -
Assume the definition of class houseType as given...Ch. 10 - Chapter 9 defined the struct studentType to...Ch. 10 - Write a program that uses the class productType...Ch. 10 -
Write a program that uses the class houseType...Ch. 10 - Prob. 6PECh. 10 - Prob. 7PECh. 10 - Some of the characteristics of a book are the...Ch. 10 - Define the class bankAccount to implement the...
Knowledge Booster
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
- Consider the definition of the class product Type as given in Exercise 8. Answer the following questions. (1, 2, 3, 5, 7) a. Write the definition of the function set so that instance variables are set according to the paramaters. Instance variables quantitieslnStock, price, and discount must be nonnegative. b. Write the definition of the function print to output the values of the instance variables. c Write the definition of the function setQuantitiesInStock to set the value of the instance variable quantitiesInStock according to the parameter. d. Write the definition of the function updateQuantitiesInStock to update the value of instance variable quantitiesInStock by adding the value of the parameter. e. Write the definition of the function getQuantitiesInStock to return the value of instance variable quantitiesInStock. f. Write the definition of the function setPrice to set the value of the instance variable price according to the parameter. g. Write the definition of the function getPrice to return the value of the instance variable price. h. Write the definition of the function setDiscount to set the value of the instance variable discount according to the parameter. i. Write the definition of the function getDiscount to return the value of the instance variable discount.arrow_forwardSuppose that you have the declarations of Exercise 7. Write the definitions of the member functions of the classes circle and cylinder. Identify the member functions of the class cylinder that overrides the member functions of the class circle. (2, 3, 4)arrow_forwardprogramming language : C++ subject : object oriented programming question: We know that an Organization consists of Managers and Employees. You are required to create a base class Person with attributes name, CNIC and gender. Derive Manager and Employee class from Person class.arrow_forward
- Explain the syntax of void functions with parameters.arrow_forward(b) Describe Dynamic Binding as related to Class loading? (c) What is the role of a class loader?arrow_forwardWhat do you think? (1) A private function declared in a base class may be redefined. (2) A static function declared in a base class may be redefined. (3) A function Object() { [native code] } may be redefined.arrow_forward
- Why is a destructor function required in classes? Illustrate with the help of an example ?arrow_forwardDefine a class for the marks (student subject marks) that includes the following data members: A (OOP) B (Data Structures) C (Calculus II) The class also contains the following member functions: Insertion function – to get three values (courses). Sum - to sum up three values (courses). Ave – to give average of the three values (courses). Display function - to display sum and average. NOTE:subject: object oriented programming(oop) Deptt:CS/ITarrow_forwardObject Oriented Programming OTHERS ACTIVITY 2 Answer the following questions to assess your learning for const keyword in classes Q1. If a class have a pointer as data member, then constant function of this class will make pointer as constant pointer or pointer to constant for that specific function? Answer: Reason: Q2. Can a non-constant member function of a class access constant data member of same class? Answer: Reason: Q3. Can a constant object call a non-constant member function of same class? Answer: Reason: Q4. Can a non-constant object call a constant member function of same class? Answer: Reason:arrow_forward
- A. Explain the difference between Classes and Objects. B. Give one example for functions declaration.arrow_forwardDifferentiate between static and instance class members. Explain with proper example when you should make members static?arrow_forwardProblem-solving part for lab 5 is similar to the problem-solving part in lab 4. However, besides the control structures, students need to add/apply Modular Programming concept to solve the problem. Kindly read the problem in Lab 4 and suggest your solution using functions. However, your modular design approach must fulfil using at least two types of these following user-define functions. (Arrange by respective lecturer/lab instructor) (a) Function that doesn't received, but can return value to the caller (b) Function which can received, but doesn't return value to the caller Problem lab 4 Design and develop a program using C++ programming language that able to do the followings: 1. Read and store data in an array as shown in yellow cell of Table 2. Table 2: Tabulated data for XZ and YZ XZ YZ XY 13.0 12.0 15.0 14.0 17.0 16.0 2. Find result of blue cell using equation 1. Store the result in the array. Equation 1: XY=Vxz? – YZ? 3. Then display a table similar to the Table 2 showing each…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Call By Value & Call By Reference in C; Author: Neso Academy;https://www.youtube.com/watch?v=HEiPxjVR8CU;License: Standard YouTube License, CC-BY