EBK PROBLEM SOLVING WITH C++
EBK PROBLEM SOLVING WITH C++
9th Edition
ISBN: 9780133834505
Author: SAVITCH
Publisher: PEARSON
bartleby

Videos

Textbook Question
Book Icon
Chapter 15, Problem 8PP

Radio Frequency IDentification (RFID) chips are small tags that can beplaced on a product. They behave like wireless barcodes and can wirelessly broadcast an identification number to a receiver. One application of RFID chips is to use them to aid in the logistics of shipping freight. Consider a shipping container full of items. Without RFID chips, a human has to manually inventory all of the items in the container to verify the contents. With an RFID chip attached to the shipping container, the RFID chip can electronically broadcast to a human the exact contents of the shipping container without human intervention.

To model this application, write a base class called ShippingContainer that has a container ID number as an integer. Include member functions to set and access the ID number. Add a virtual function called getManifest that returns an empty string. The purpose of this function is to return the contents of the shipping container.

Create a derived class called ManualShippingContainer that represents the manual method of inventorying the container. In this method, a human simply attaches a textual description of all contents of the container. For example, the description might be “4 crates of apples. 10 crates of pears.” Add a new class variable of type string to store the manifest. Add a function called setManifest that sets this string. Override the getManifest function so that it returns this string.

Create a second derived class called RFIDShippingContainer that represents the RFID method of inventorying the container. To simulate what the RFID chips would compute, create an add function to simulate adding an item to the container. The class should store a list of all added items (as a string) and their quantity using the data structures of your choice. For example, if the add function were invoked three times as follows:

rfidContainer.add("crate of pears"); // Add one crate of pears

rfidContainer.add("crate of apples"); // Add one crate of apples

rfidContainer.add("crate of pears"); // Add one crate of pears

At this point, the data structure should be storing a list of two items: crate of apples and crate of pears. The quantity of apples is 1and the quantity of pears is 2. Override the getManifest function so that it returns a string of all items that is built by traversing the list of items. In the example above, the return string would be “2 crate of pears. 1 crate of apples.“ Finally, write a main program that creates an array of pointers to six ShippingContainer objects. Instantiate the array with three Manual-ShippingContainer objects and three RFIDShippingContainer objects. For the ManualShippingContainer objects, you will have to invoke setManifestto set the contents. For the RFIDShippingContainer objects, you will have to invoke add to set the contents (although, if this were real, the contents of the container would “add” themselves via the RFID chips instead of requiring a human to type them in). Finally, write a loop that iterates through all ShippingContainer pointers and outputs each object’s manifestalong with the shipping container ID. This is the output that the receiver of the shipping containers would like to see.

You may need to convert an integer into a string. A simple way to do this in C++11 is: string s = to_string(intVariable);

Blurred answer
Students have asked these similar questions
A robot starts on a point marked “A” on a rectangular grid of points. The starting point is always the top left point on the grid. The robot can move left, right, up or down, moving from one point to the next. By moving in steps going left, right, up or down, the robot would like to reach a point marked “B”, which is always the bottom right point in the grid. Sometimes, points are marked as “x”, and the robot is not allowed to visit them at all. A robot is never allowed to visit a point more than once. In how many ways can the robot move from A to B and visit all points along the way? For example, in the following grid, represented in text as A   .   .  .   .   B  there is only one path from A to B: In the following grid, represented in text as A   .   . x   x  B there is still only one path (we're lucky because of the two x's): However, in the grid A   .   .  .   x  B there are no ways for the robot to move from A to B and visit all points that are not marked with “x”. Write a single…
Consider a North American traffic light. The light (Traffic Light #1) is red by default, and only turns green when a car is present at the red light, as sensed by the car presence sensor, and the light stays green as long as there is a car sensed. If a walker presses a button to request to cross the street, or if there are no cars present, the light turns yellow, and then red on the next clock trigger. The walk button has priority over the presence of a car, and the light will stay red when a walker presses the walk button.   a. Draw the state machine diagram. The color of the light is the output of the system. b. Find Boolean expressions for the flip flop input equations and output equations
In programming, we use the mask concept to indicate information that can be shown to the user and information that must be “masked”, that is, hidden. In an implementation of a hangman game, we use a mask to indicate which secret word positions the player has already guessed right (whose the contents must therefore be shown to the player), and which positions must remain hidden. Each time that the player hits a letter of the hidden word, the mask is updated so that it has little dashes in the places of letters that the player has not hit yet and show it, in their proper place, the letters that he already hit it. For example, if the word is "cards", the current mask is: - a - - s and the player guesses the letter "d", the mask should be updated to: - a - ds.Write a function called update_mask that takes as input a string containing the word secret (in the example above, this word would be “cards”), a list whose elements are the characters of the current mask (in the example above…

Chapter 15 Solutions

EBK PROBLEM SOLVING WITH C++

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
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Java random numbers; Author: Bro code;https://www.youtube.com/watch?v=VMZLPl16P5c;License: Standard YouTube License, CC-BY