Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For the given header( Here is a link to the Assembly.h file.) //Assembly.h #ifndef ASSEMBLY_H #define ASSEMBLY_H #include #include Part.h using namespace std; class Assembly

image text in transcribed

image text in transcribed

image text in transcribed

For the given header( Here is a link to the Assembly.h file.)

//Assembly.h
#ifndef ASSEMBLY_H
#define ASSEMBLY_H
#include
#include "Part.h"
using namespace std;
class Assembly : public Part{
private:
vector m_parts;
public:
//Assembly constructor
Assembly(string id, string dwg, int qty);
//Add a part to this assembly
void addPart(Part p);
//Print out the BOM
string toString();
};
#endif

image text in transcribed

Programming Assignment DUE Date: See your Blackboard Objectives Use Inheritance- extend a base class Use the vector class from the standard template library Using standard in and standard out Implement basic user data validation Extend existing code to create a new program Tasks For this homework you are going to extend the Part class and create a simple Bill of Material (BOM) that represents an assembly. We will take the part class and extend it using Inheritance to create an assembly class. Using the is-a relationship test, we know that an assembly IS-A part however a part is not necessarily an assembly. In other words our base class will be a part, and our child class will be an assembly. Your job is to implement the class defined in Assembly.lh You must use the public methods defined on Part.h to get and set the private variables defined in Part. You will be adding two new methods in Assembly.cpp and overriding the toString method. In the Assembly method you should use the stringstream class to build up a string object that contains the Assembly Id, Drawing, and Quantity, as well as, the parts of the Assembly, which is returned to the caller. Call the toString function in each Part object in the parts vector to get the string representation of each Part. Your main function should read from standard in an Assembly. Here is a link to the Assembly.h file You will need to write your own 'main' program, which you can 'reverse-engineer' from the sample output below Using stringstreanm To get full credit for this assignment, you need to use the stringstream object to build the string returned in the toString accessor. You can think of a string stream as a bunch of characters floating down a stream sequentially where they all stack up at a dam. They aren't a string yet, they're still in the stream. You then need to convert the stringstream into a string, which can then be returned from the toString accessor to the caller. To use the stringstream object you need to include 'sstream' into your program. For background on how to use the stringstream object you can start here Programming Assignment DUE Date: See your Blackboard Objectives Use Inheritance- extend a base class Use the vector class from the standard template library Using standard in and standard out Implement basic user data validation Extend existing code to create a new program Tasks For this homework you are going to extend the Part class and create a simple Bill of Material (BOM) that represents an assembly. We will take the part class and extend it using Inheritance to create an assembly class. Using the is-a relationship test, we know that an assembly IS-A part however a part is not necessarily an assembly. In other words our base class will be a part, and our child class will be an assembly. Your job is to implement the class defined in Assembly.lh You must use the public methods defined on Part.h to get and set the private variables defined in Part. You will be adding two new methods in Assembly.cpp and overriding the toString method. In the Assembly method you should use the stringstream class to build up a string object that contains the Assembly Id, Drawing, and Quantity, as well as, the parts of the Assembly, which is returned to the caller. Call the toString function in each Part object in the parts vector to get the string representation of each Part. Your main function should read from standard in an Assembly. Here is a link to the Assembly.h file You will need to write your own 'main' program, which you can 'reverse-engineer' from the sample output below Using stringstreanm To get full credit for this assignment, you need to use the stringstream object to build the string returned in the toString accessor. You can think of a string stream as a bunch of characters floating down a stream sequentially where they all stack up at a dam. They aren't a string yet, they're still in the stream. You then need to convert the stringstream into a string, which can then be returned from the toString accessor to the caller. To use the stringstream object you need to include 'sstream' into your program. For background on how to use the stringstream object you can start here

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Management Systems

Authors: Patricia Ward, George A Dafoulas

1st Edition

ISBN: 1844804526, 978-1844804528

More Books

Students also viewed these Databases questions

Question

Was ignoring the problem an option? Why?

Answered: 1 week ago