C++ Programming: From Problem Analysis to Program Design
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN: 9781337102087
Author: D. S. Malik
Publisher: Cengage Learning
bartleby

Videos

Textbook Question
100%
Book Icon
Chapter 10, Problem 10SA

Consider the definition of the class product Type as given in Exercise 8.

Answer the following questions. (1, 2, 3, 5, 7)

  1. 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.

  2. Write the definition of the function print to output the values of the instance variables.

  3. Write the definition of the function setQuantitiesInStock to set the value of the instance variable quantitiesInStock according to the parameter.

  4. Write the definition of the function updateQuantitiesInStock to update the value of instance variable quantitiesInStock by adding the value of the parameter.

  5. Write the definition of the function getQuantitiesInStock to return the value of instance variable quantitiesInStock.

  6. Write the definition of the function setPrice to set the value of the instance variable price according to the parameter.

  7. Write the definition of the function getPrice to return the value of the instance variable price.

  8. Write the definition of the function setDiscount to set the value of the instance variable discount according to the parameter.

  9. Write the definition of the function getDiscount to return the value of the instance variable discount.

Blurred answer
Students have asked these similar questions
What is Windows Server and what is the Differences between Windows Server 2019 and the Windows Operating System that people have installed on their personal computer.
solve and show the tree on paper
I need help to resolve the following activity
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
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Call By Value & Call By Reference in C; Author: Neso Academy;https://www.youtube.com/watch?v=HEiPxjVR8CU;License: Standard YouTube License, CC-BY