Starting Out With C++, Early Objects - With Access Package
Starting Out With C++, Early Objects - With Access Package
8th Edition
ISBN: 9780133441840
Author: GADDIS
Publisher: PEARSON
bartleby

Concept explainers

bartleby

Videos

Textbook Question
Book Icon
Chapter 8, Problem 15PC

Bin Manager Class

Design and write an object -oriented program for managing inventory bins in a warehouse. To do this you will use two classes: InvBin and BinManager. The InvBin class holds information about a single bin. The BinManager class will own and manage an array of InvBin objects. Here is a skeleton of what the InvBin and BinManager class declarations should look like:

class InvBin

{

private:

string description;    //Item name

int qty;    // Quantity of items

  // in this bin

public:

InvBin (string d = “empty”, int q = 0) // 2-parameter constructor

{ description = d: qty = q: }    // with default values

// It will also have the following public member functions. They

// will be used by the BinManager class not the client program.

void setDescription(string d)

string getDescription()

void setQty(1nt q)

int getQty( )

};

class BinManager

{

Private:

InvBin bm[30]:    // Array of InvBin objects

int numBins;     // Number of bins

  // currently 1n use

public:

BinManager()    // Default constructor

{ numBins = 0; )

BinManager(int size, string d[], int q[])    //3-parameter constructor

{

//Receives number of bins in use and parallel arrays of item names

//and quantities. Uses this info. to store values in the elements

//of the bin array. Remember, these elements are InvBin objects.

}

// The class will also have the following public member functions:

 string getDescription(int index)    // Returns name of one item

int getQuantity{int index)    // Returns qty of one item

bool addParts{int binlndex, int q)    //These return true if the

bool removeParts(int binlndex , int q)    //action was done and false

  // if it could not be done

  //see validation information

Client Program

Once you have created these two classes, write a menu-driven client program that uses a BinManager object to manage its warehouse bins. It should initialize it to use nine of the bins, holding the following item descriptions and quantities. The bin index where the item will be stored is also shown here.

1. regular pliers 25 2. n. nose pliers 5 3. screwdriver 25
4. p. head screw driver 6 5. wrench-large 7 6. wrench-small 18
7. drill 51 8. cordless drill 16 9. hand saw 12

The modular client program should have functions to display a menu, get and validate the user's choice, and carry out the necessary activities to handle that choice. This includes adding items to a bin, removing items from a bin, and displaying a report of all bins. Think about what calls the displayReport client function will need to make to the BinManager object to create this report. When the user chooses the “Quit” option from the menu, the program should call its displayReport function one last time to display the final bin information. All 1/0 should be done in the client class. The BinManager class only accepts information, keeps the array of InvBin objects up to date, and returns information to the client program.

Input Validation: The BinManager class functions should not accept numbers less than 1 for the number of parts being added or removed from a bin. They should also not allow the user to remove more items from a bin than it currently holds.

Blurred answer
Students have asked these similar questions
C++ Code: Goal: Write a Class to represent Fractions Write a Fraction class whose objects will represent fractions. For example, a fraction of 3/7 will be represented by a Fraction object whose numerator will be set to 3 and denominator will be set to 7. Implementation Note: For this checkpoint do not reduce fractions (i.e. 15/18 should NOT be reduced to 5/6), do not use "const" (since we haven't discussed in class yet)  Attributes: Your class should have exactly two private data members, one to represent the numerator of the Fraction being represented, and one to represent the denominator of the Fraction being represented. (What should be the data type of these member variables?) Member functions: A default constructor that sets the fraction to 0 (what should be the numerator and denominator for such a fraction?). A parametrized constructor takes two integer arguments, a numerator and a denominator, and assigns the attributes accordingly. Arithmetic operations that add,…
Network Class The Network class represents a network of people that are connected to each other and are able to contact and send messages to each other through the network. Create a Network class with the following: Member Variables A Network has just one private member variable: phonebook_ - a std::map which maps from a std::string for a person's name, to the std::shared_ptr<Phone> object that belongs to that person. Constructor You do not need to explicitly define a constructor. The default constructor will implicitly be created for us by the compiler, initializing the phonebook_ to an empty map. AddPhone Create a function AddPhone that accepts a std::shared_ptr to a Phone and inserts that Phone to the phonebook_. The key is the name of that phone's owner, and the value is the shared pointer to the Phone. SendMessage Create a function SendMessage that accepts a std::shared_ptr to a Message and a const reference to a std::string representing the intended recipient of this…
Circle Class (Easy)   Write a Circle class that has the following member variables: radius : a  double    The class should have the following member functions:    Default Constructor:  default constructor that sets radius to 0.0.  Constructor: accepts the radius of the circle as an argument.  setRadius: an mutator function for the radius variable. getRadius: an accessor function for the radius variable. getArea: returns the area of the circle, which is calculated as area = pi * radius * radius    getCircumference: returns the circumference of the circle, which is calculated as circumference = 2 * pi * radius         Step1:  Create a declaration of the class.   Step2: Write a program that demonstrates the Circle class by asking the user for the circle’s radius, creating              Circle objects, and then reporting the circle’s area, and circumference.                You should create at least two circle objects, one sets the radius to 0.0 and one accepts the radius as an…

Chapter 8 Solutions

Starting Out With C++, Early Objects - With Access Package

Ch. 8.6 - Given the following array definition: int values...Ch. 8.6 - Prob. 8.12CPCh. 8.6 - Prob. 8.13CPCh. 8.6 - What is the output of the following code? const...Ch. 8.8 - Write a typedef statement that makes the name...Ch. 8.8 - Prob. 8.16CPCh. 8.8 - What is the output of the following program...Ch. 8.8 - The following program segments, when completed,...Ch. 8.10 - Prob. 8.19CPCh. 8.10 - Prob. 8.20CPCh. 8.10 - Prob. 8.21CPCh. 8.10 - Prob. 8.22CPCh. 8.10 - Prob. 8.23CPCh. 8.10 - Fill in the empty table below so it shows the...Ch. 8.10 - Write a function called displayArray7. The...Ch. 8.10 - Prob. 8.26CPCh. 8.11 - Prob. 8.27CPCh. 8.11 - Write definition statements for the following...Ch. 8.11 - Define gators to be an empty vector of ints and...Ch. 8.12 - True or false: The default constructor is the only...Ch. 8.12 - True or false: All elements in an array of objects...Ch. 8.12 - What will the following program display on the...Ch. 8.12 - Complete the following program so that it defines...Ch. 8.12 - Add two constructors to the Product structure...Ch. 8.12 - Prob. 8.35CPCh. 8.12 - Prob. 8.36CPCh. 8.12 - Prob. 8.37CPCh. 8.12 - Write the definition for an array of five Product...Ch. 8.12 - Write a structure declaration called Measurement...Ch. 8.12 - Write a structure declaration called Destination ,...Ch. 8.12 - Define an array of 20 Destination structures (see...Ch. 8 - The ________ indicates the number of elements, or...Ch. 8 - The size declarator must be a(n) _______ with a...Ch. 8 - Prob. 3RQECh. 8 - Prob. 4RQECh. 8 - The number inside the brackets of an array...Ch. 8 - C++ has no array ________ checking, which means...Ch. 8 - Prob. 7RQECh. 8 - If a numeric array is partially initialized, the...Ch. 8 - If the size declarator of an array definition is...Ch. 8 - Prob. 10RQECh. 8 - Prob. 11RQECh. 8 - Prob. 12RQECh. 8 - Arrays are never passed to functions by _______...Ch. 8 - To pass an array to a function, pass the ________...Ch. 8 - A(n) ________ array is like several arrays of the...Ch. 8 - Its best to think of a two -dimensional array as...Ch. 8 - Prob. 17RQECh. 8 - Prob. 18RQECh. 8 - When a two -dimensional array is passed to a...Ch. 8 - Prob. 20RQECh. 8 - Look at the following array definition. int values...Ch. 8 - Given the following array definition: int values...Ch. 8 - Prob. 23RQECh. 8 - Assume that array1 and array2 are both 25-element...Ch. 8 - Prob. 25RQECh. 8 - How do you establish a parallel relationship...Ch. 8 - Look at the following array definition. double...Ch. 8 - Prob. 28RQECh. 8 - Prob. 29RQECh. 8 - Prob. 30RQECh. 8 - Prob. 31RQECh. 8 - The following code totals the values in each of...Ch. 8 - In a program you need to store the identification...Ch. 8 - Prob. 34RQECh. 8 - Prob. 35RQECh. 8 - Prob. 36RQECh. 8 - Prob. 37RQECh. 8 - Prob. 38RQECh. 8 - Each of the following functions contains errors....Ch. 8 - Soft Skills Diagrams are an important means of...Ch. 8 - Perfect Scores 1. Write a modular program that...Ch. 8 - Roman Numeral Converter Write a program that...Ch. 8 - Chips and Salsa Write a program that lets a maker...Ch. 8 - Monkey Business A local zoo wants to keep track of...Ch. 8 - Rain or Shine An amateur meteorologist wants to...Ch. 8 - Lottery Write a program that simulates a lottery....Ch. 8 - Rainfall Statistics Write a modular program that...Ch. 8 - Chips and Salsa Version 2 Revise Programming...Ch. 8 - Stats Class and Rainfall Statistics Create a Stats...Ch. 8 - Stats Class and Track Statistics Write a client...Ch. 8 - Prob. 11PCCh. 8 - Drivers License Exam The State Department of Motor...Ch. 8 - Array of Payro11 Objects Design a PayRoll class...Ch. 8 - Drink Machine Simulator Create a class that...Ch. 8 - Bin Manager Class Design and write an object...Ch. 8 - Tic-Tac-Toe Game Write a modular program that...Ch. 8 - Theater Ticket Sales Create a TicketManager class...
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
    Microsoft Visual C#
    Computer Science
    ISBN:9781337102100
    Author:Joyce, Farrell.
    Publisher:Cengage Learning,
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
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