EBK MINDTAPV2.0 FOR MALIK'S C++ PROGRAM
EBK MINDTAPV2.0 FOR MALIK'S C++ PROGRAM
8th Edition
ISBN: 9780357425251
Author: Malik
Publisher: VST
bartleby

Concept explainers

bartleby

Videos

Textbook Question
Book Icon
Chapter 10, Problem 8SA

Consider the definition of the following class: (1, 2, 3, 5, 7)

classproductType                                    //Line 1 {                                                             //Line 2 public:                                                   //Line 3 productType();                                      //Line 4 productType ( int, double, double ) ;       //Line 5 productType(string, int, double, double);//Line 6 productType(string, string, string, int, double, double);                                //Line 7 voidset(string, string, string, int, double, double);                                       //Line 8 voidprint()const;                                     //Line 9 voidsetQuantitiesInStock(intx);              //Line 10

void updateQuantitiesInStock (int x);                 //Line11 int getQuantitiesInStock () const;                       //Line12 void setPrice (doublex);                                   //Line13 doublegetPrice()const;                                   //Line14 voidsetDiscount(doubled);                            //Line15 doublegetDiscount()const;                           //Line16 private:                                                        //Line17 string productName;                                   //Line18 string id;                                                     //Line19 string manufacturer;                                  //Line20 int quantitiesInStock;                                //Line21 double price;                                             //Line22 double discount;                                        //Line23 };                                                               //Line24

  1. Give the line number containing the constructor that is executed in each of the following declarations.

    i . productType productl; ii . productType product2 ( "Microwave" , "M3562", "GeneralPool", 35, 175 .00, 0 .1); iii . productType product3  ( "D1290", 25, 375 .00, 0 .05 ) ; iv . productType product4 ( 10, 8 .50, 0 .2 ) ;

  2. Write the definition of the constructor in Line 4 so that the instance variables are initialized to “ “, “ “, “ “, 0, 0.0, and 0.0, respectively.

  3. Write the definition of the constructor in Line 5 so that the string instance variables are initialized to””, and the other instance variables are initialized according to the parameters. Instance variables quantitieslnStock, price, and discount must be nonnegative.

  4. Write the definition of the constructor in Line 6 so that the instance variables productName and manufacturer are initialized to the empty string, instance variable id is initialized according to the first parameter, and the remaining instance variables are initialized according to the last three parameters. Instance variables quantitieslnStock, price, and discount must be nonnegative.

  5. Write the definition of the constructor in Line 7 so that the instance variables are initialized according to the parameters. Instance variables quantitieslnStock, price, and discount must be nonnegative.

Blurred answer
Students have asked these similar questions
Please answer the JAVA OOP Programming Assignment scenario below: Patriot Ships is a new cruise line company which has a fleet of 10 cruise ships, each with a capacity of 300 passengers. To manage its operations efficiently, the company is looking for a program that can help track its fleet, manage bookings, and calculate revenue for each cruise. Each cruise is tracked by a Cruise Identifier (must be 5 characters long), cruise route (e.g. Miami to Nassau), and ticket price. The program should also track how many tickets have been sold for each cruise. Create an object-oriented solution with a menu that allows a user to select one of the following options: 1. Create Cruise – This option allows a user to create a new cruise by entering all necessary details (Cruise ID, route, ticket price). If the maximum number of cruises has already been created, display an error message. 2. Search Cruise – This option allows to search a cruise by the user provided cruise ID. 3. Remove Cruise – This op…
I need to know about the use and configuration of files and folders, and their attributes in Windows Server 2019.
Southern Airline has 15 daily flights from Miami to New York.  Each flight requires two pilots.  Flights that do not have two pilots are canceled (passengers are transferred to other airlines).  The average profit per flight is $6000.  Because pilots get sick from time to time, the airline is considering a policy of keeping four *reserve pilots on standby to replace sick pilots.  Such pilots would introduce an additional cost of $1800 per reserve pilot (whether they fly or not). The pilots on each flight are distinct and the likelihood of any pilot getting sick is independent of the likelihood of any other pilot getting sick.  Southern believes that the probability of any given pilot getting sick is 0.15.  A) Run a simulation of this situation with at least 1000 iterations and report the following for the present policy (no reserve pilots) and the proposed policy (four reserve pilots): The average daily utilization of the aircraft (percentage of total flights that fly) The…
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
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
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
Text book image
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Introduction to Classes and Objects - Part 1 (Data Structures & Algorithms #3); Author: CS Dojo;https://www.youtube.com/watch?v=8yjkWGRlUmY;License: Standard YouTube License, CC-BY