Hello! I would appreciate some help doing this assignment for my C++ class. All
ID: 662609 • Letter: H
Question
Hello! I would appreciate some help doing this assignment for my C++ class. All that we were taught in this class was based off the book C++ Programming From Problem Analysis to Program Design
Thank you in advance!
Create an Inventory class with the following properties:
InvNumber: A string used to hold an inventory number. Each item in the inventory should have a unique inventory number.
Description: A string that holds a brief description of the item.
Cost: A decimal value that holds the amount that the retail store paid for the item.
Retail: A decimal value that holds the retail price of the item.
OnHand: An integer value that holds the number of items on hand. This value cannot be less than 0.
Create constructors, destructors, accessors, mutators, and custom methods as needed
Explanation / Answer
// class Inventory
#include <iostream>
using namespace std;
class Inventory{
private:
string InvNumber;
string Description;
double Cost;
double Retail;
int OnHand;
public:
Inventory(string in, string d, double c, double r, int o){
InvNumber = in;
Description = d;
Cost = c;
Retail = r;
> }
~Inventory(){
}
void setInvNumber(string in){
InvNumber = in;
}
void setDescription(string d){
Description = d;
}
void setCost(double c){
Cost = c;
}
void setRetail(double r){
Retail = r;
}
void setOnHand(int o){
> }
string getInvNumber(){
return InvNumber;
}
string getDescription(){
return Description;
}
double getCost(){
return Cost;
}
double getRetail(){
return Retail;
}
int getOnHand(){
return OnHand;
}
};
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.