EP MINDTAPV2.0 FOR MALIK'S C++ PROGRAMM
EP MINDTAPV2.0 FOR MALIK'S C++ PROGRAMM
8th Edition
ISBN: 9780357425237
Author: 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
Write the definition of a void function that takes as input two parameters of type int, say sum and testScore the function updates the value of sum by adding the value of testScore. The new value of sum is reflected in the calling environment.
16. Assume the declaration of Exercise 14. (Each of these have { and } and will be on their own lines.) A. Write the definition of the default constructor of smart so that the instance variables of smart are initialized to 0. B. Write the definition of the default constructor of superSmart so that the instance variables of superSmart are initialized to 0. C. Write the definition of the mermber function set of smart so that the instance variables are initialized according to the parameters. D. Write the definition of the member function sum of the class smart so that it returns the sum of the instance variables. E. Write the definition of the member function manipulate of the class superSmart so that it returns the (x + y)? , that is, return x plus y to the power of z.
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
Call By Value & Call By Reference in C; Author: Neso Academy;https://www.youtube.com/watch?v=HEiPxjVR8CU;License: Standard YouTube License, CC-BY