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
SUBJECT: OOPPROGRAMMING LANGUAGE: C++ ALSO ADD SCREENSHOTS OF OUTPUT.   Write a class Distance to measure distance in meters and kilometers. The class should have appropriate constructors for initializing members to 0 as well as user provided values. The class should have display function to display the data members on screen.   Write another class Time to measure time in hours and minutes. The class should have appropriate constructors for initializing members to 0 as well as user provided values. The class should have display function to display the data members on screen.   Write another class which has appropriate functions for taking objects of the Distance class and Time class to store time and distance in a file.   Make the data members and functions in your program const where applicable
I need the answer as soon as possible
Subject: Object oriented Programming ( In OOP)
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