PLEASE FOLLOW THE INSTRUCTIONS OF THE CODE VendingMachines.h // what to include class VendingMachines{ private: string location; // where the vending machine is located, AKA the machine's name int snackCount; // the number of different snacks in the machine double moneyIn; // money deposited by customer double change; // the amount of money available for change double totalSales; // the amount of money from item sales Snacks** inventory; // the snacks available for sale int computeChange(); // computes the change due, if any int snackNameSize; // The size of the longest snack name + 3 spaces int computeSnackNameSize(); // computes the longest snack name public: VendingMachines(); // the default constructor VendingMachines(string); // parameterized constructor void setLocation(string); void addSnack(); void sellSnack(); void printInventory() const; int getSnackCount() const; double getTotalSales() const; } +++++++++++++++++++++++++++++++++ VendingMachines.cpp // what to include // private method used to compute the change due, if any // this method changes the value of the change field. If the value of // change is 0, the method must indicate that exact money // is required to purchase an item. int computeChange(); // private method used to set the value for the snackNameSize field. // It iterates through the inventory to find the longest snack name, // then sets the snackNameSize field to the longest value + 3 int computeSnackNameSize(); // The default constructor initializes strings to "", pointers to null, // change to one dollar, and all other fields to 0 VendingMachines(); // The parameterized constructor initializes location to the parameter value, // the pointer to null, change to one dollar, and all other fields to 0 VendingMachines(string); // sets the vending's machine identifier void setLocation(string); // adds a Snacks object to inventory // Should this method include parameters? // If so, which? void addSnack(); // sells a snack from inventory // this method alters the value of the change and // totalSales fields. // Should this method include parameters? // If so, which? void sellSnack(); // prints the current vending machine inventory // should print items in a manu style format // the output from this method is presented to // the customer as the menu of items available for purchase // Use the following header format: // # Item Price // Example: // Which snack would you like to purchase? // 1. Doritos $0.75 // 2. Milky Way $1.00 // 3. 3 Musketeers $1.25 // NOTE: The size of the name field must accomodate any snack name. // This size is dynamic, and adapts to any name. // If the count for a specific snack is 0, such snack name // should not be printed. void printInventory() const; // gets the count of different snacks available in the machine. // For example, if the machine is composed of the items shown // in the examplefor printInventory, this method would return 3. int getSnackCount() const; // gets the total value of sales, in dollars double getTotalSales() const; ++++++++++++++++++++++++++++++++++++++++++ Snack.h // what to include class Snack{ private: string name; // the snack's name int nameSize; // the size of the name field int count; // the number of snacks of this type double price; // the price per snack unit public: Snack(); // the default constructor Snack(string); // parameterized constructor Snack(string,int,double); // parameterized constructor ~Snack(); // the destructor void setName(string); void setCount(int); void setPrice(double); string getName() const; string getNameSize() const; int getCount() const; double getPrice() const; } +++++++++++++++++++++++++++++++++++++++++++ Snack.cpp // what to include // The default constructor initializes the string to "" // and all other fields to 0 Snack(); // This parameterized constructor get the snack's name as // parameter, intializes the nameSize field accordingly, and // initializes all other fields to 0 Snack(string); // This constructor has three parameters: the snack's name, // its count, and its price. It initializes the nameSize field // according to the name's size. Snack(string,int,double); // The destructor for the Snack class releases memory // for the object and prints the phrase // "The snack [snack] has been removed from inventory" ~Snack(); // sets the snack's name and the nameSize fields void setName(string); // sets the quantity of snack items void setCount(int); // sets the price for the snack void setPrice(double); // get the name of the snack string getName() const; // get the size of the name field string getNameSize() const; // get the count of the snack int getCount() const; // get the price for the snack double getPrice() const; +++++++++++++++++++++++++++++++++++ Main.cpp // what to include int mainMenu(); int adminMenu(); int snackMenu(); bool execute(int,VendingMachine&); int sanitize(string); int main(){ // declare a VendingMachines object named thirdFloor, // whose identifier is L-3rd Floor // develop a while iteration control structure which // calls the execute method to operate the machine // You should add, at least, five different snacks to // the vending machine's inventory, and demonstrate that // the vending machine operates properly. // print the phrase // "Program developed by [team member 1 name], ID#[team member 1 ID NUMBER HERE], // and [team member 2 name], ID#[team member 2 ID NUMBER HERE]" // where the square brackets and the text within must be replaced with your information return 0; } // This method prints the main menu // The options are: // 1. Manage the vending machine // 2. Purchase snacks // 3. Shutdown the vending machine int mainMenu(){ } // This method prints the administrative menu // where the options are to add a snack, to remove // a snack, to add more items for an existing snack, // and to get the total sales. int adminMenu(){ } // This method prints the inventory available // for sale, and returns the selected option value int snackMenu(){ } // This method executes the actions from the menu (or menus ???) // It returns false only if the shutdown action has been requested bool execute(int){ } // This methods receives a string and extracts the integer // value of the selected option. // The method should return -1 if the parameter contains // characters other than digits, otherwise returns the // integer value of the digits int sanitize(string){ }
PLEASE FOLLOW THE INSTRUCTIONS OF THE CODE VendingMachines.h // what to include class VendingMachines{ private: string location; // where the vending machine is located, AKA the machine's name int snackCount; // the number of different snacks in the machine double moneyIn; // money deposited by customer double change; // the amount of money available for change double totalSales; // the amount of money from item sales Snacks** inventory; // the snacks available for sale int computeChange(); // computes the change due, if any int snackNameSize; // The size of the longest snack name + 3 spaces int computeSnackNameSize(); // computes the longest snack name public: VendingMachines(); // the default constructor VendingMachines(string); // parameterized constructor void setLocation(string); void addSnack(); void sellSnack(); void printInventory() const; int getSnackCount() const; double getTotalSales() const; } +++++++++++++++++++++++++++++++++ VendingMachines.cpp // what to include // private method used to compute the change due, if any // this method changes the value of the change field. If the value of // change is 0, the method must indicate that exact money // is required to purchase an item. int computeChange(); // private method used to set the value for the snackNameSize field. // It iterates through the inventory to find the longest snack name, // then sets the snackNameSize field to the longest value + 3 int computeSnackNameSize(); // The default constructor initializes strings to "", pointers to null, // change to one dollar, and all other fields to 0 VendingMachines(); // The parameterized constructor initializes location to the parameter value, // the pointer to null, change to one dollar, and all other fields to 0 VendingMachines(string); // sets the vending's machine identifier void setLocation(string); // adds a Snacks object to inventory // Should this method include parameters? // If so, which? void addSnack(); // sells a snack from inventory // this method alters the value of the change and // totalSales fields. // Should this method include parameters? // If so, which? void sellSnack(); // prints the current vending machine inventory // should print items in a manu style format // the output from this method is presented to // the customer as the menu of items available for purchase // Use the following header format: // # Item Price // Example: // Which snack would you like to purchase? // 1. Doritos $0.75 // 2. Milky Way $1.00 // 3. 3 Musketeers $1.25 // NOTE: The size of the name field must accomodate any snack name. // This size is dynamic, and adapts to any name. // If the count for a specific snack is 0, such snack name // should not be printed. void printInventory() const; // gets the count of different snacks available in the machine. // For example, if the machine is composed of the items shown // in the examplefor printInventory, this method would return 3. int getSnackCount() const; // gets the total value of sales, in dollars double getTotalSales() const; ++++++++++++++++++++++++++++++++++++++++++ Snack.h // what to include class Snack{ private: string name; // the snack's name int nameSize; // the size of the name field int count; // the number of snacks of this type double price; // the price per snack unit public: Snack(); // the default constructor Snack(string); // parameterized constructor Snack(string,int,double); // parameterized constructor ~Snack(); // the destructor void setName(string); void setCount(int); void setPrice(double); string getName() const; string getNameSize() const; int getCount() const; double getPrice() const; } +++++++++++++++++++++++++++++++++++++++++++ Snack.cpp // what to include // The default constructor initializes the string to "" // and all other fields to 0 Snack(); // This parameterized constructor get the snack's name as // parameter, intializes the nameSize field accordingly, and // initializes all other fields to 0 Snack(string); // This constructor has three parameters: the snack's name, // its count, and its price. It initializes the nameSize field // according to the name's size. Snack(string,int,double); // The destructor for the Snack class releases memory // for the object and prints the phrase // "The snack [snack] has been removed from inventory" ~Snack(); // sets the snack's name and the nameSize fields void setName(string); // sets the quantity of snack items void setCount(int); // sets the price for the snack void setPrice(double); // get the name of the snack string getName() const; // get the size of the name field string getNameSize() const; // get the count of the snack int getCount() const; // get the price for the snack double getPrice() const; +++++++++++++++++++++++++++++++++++ Main.cpp // what to include int mainMenu(); int adminMenu(); int snackMenu(); bool execute(int,VendingMachine&); int sanitize(string); int main(){ // declare a VendingMachines object named thirdFloor, // whose identifier is L-3rd Floor // develop a while iteration control structure which // calls the execute method to operate the machine // You should add, at least, five different snacks to // the vending machine's inventory, and demonstrate that // the vending machine operates properly. // print the phrase // "Program developed by [team member 1 name], ID#[team member 1 ID NUMBER HERE], // and [team member 2 name], ID#[team member 2 ID NUMBER HERE]" // where the square brackets and the text within must be replaced with your information return 0; } // This method prints the main menu // The options are: // 1. Manage the vending machine // 2. Purchase snacks // 3. Shutdown the vending machine int mainMenu(){ } // This method prints the administrative menu // where the options are to add a snack, to remove // a snack, to add more items for an existing snack, // and to get the total sales. int adminMenu(){ } // This method prints the inventory available // for sale, and returns the selected option value int snackMenu(){ } // This method executes the actions from the menu (or menus ???) // It returns false only if the shutdown action has been requested bool execute(int){ } // This methods receives a string and extracts the integer // value of the selected option. // The method should return -1 if the parameter contains // characters other than digits, otherwise returns the // integer value of the digits int sanitize(string){ }
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
PLEASE FOLLOW THE INSTRUCTIONS OF THE CODE
VendingMachines.h
// what to include
class VendingMachines{
private:
string location; // where the vending machine is located, AKA the machine's name
int snackCount; // the number of different snacks in the machine
double moneyIn; // money deposited by customer
double change; // the amount of money available for change
double totalSales; // the amount of money from item sales
Snacks** inventory; // the snacks available for sale
int computeChange(); // computes the change due, if any
int snackNameSize; // The size of the longest snack name + 3 spaces
int computeSnackNameSize(); // computes the longest snack name
public:
VendingMachines(); // the default constructor
VendingMachines(string); // parameterized constructor
void setLocation(string);
void addSnack();
void sellSnack();
void printInventory() const;
int getSnackCount() const;
double getTotalSales() const;
}
+++++++++++++++++++++++++++++++++
VendingMachines.cpp
// what to include
// private method used to compute the change due, if any
// this method changes the value of the change field. If the value of
// change is 0, the method must indicate that exact money
// is required to purchase an item.
int computeChange();
// private method used to set the value for the snackNameSize field.
// It iterates through the inventory to find the longest snack name,
// then sets the snackNameSize field to the longest value + 3
int computeSnackNameSize();
// The default constructor initializes strings to "", pointers to null,
// change to one dollar, and all other fields to 0
VendingMachines();
// The parameterized constructor initializes location to the parameter value,
// the pointer to null, change to one dollar, and all other fields to 0
VendingMachines(string);
// sets the vending's machine identifier
void setLocation(string);
// adds a Snacks object to inventory
// Should this method include parameters?
// If so, which?
void addSnack();
// sells a snack from inventory
// this method alters the value of the change and
// totalSales fields.
// Should this method include parameters?
// If so, which?
void sellSnack();
// prints the current vending machine inventory
// should print items in a manu style format
// the output from this method is presented to
// the customer as the menu of items available for purchase
// Use the following header format:
// # Item Price
// Example:
// Which snack would you like to purchase?
// 1. Doritos $0.75
// 2. Milky Way $1.00
// 3. 3 Musketeers $1.25
// NOTE: The size of the name field must accomodate any snack name.
// This size is dynamic, and adapts to any name.
// If the count for a specific snack is 0, such snack name
// should not be printed.
void printInventory() const;
// gets the count of different snacks available in the machine.
// For example, if the machine is composed of the items shown
// in the examplefor printInventory, this method would return 3.
int getSnackCount() const;
// gets the total value of sales, in dollars
double getTotalSales() const;
++++++++++++++++++++++++++++++++++++++++++
Snack.h
// what to include
class Snack{
private:
string name; // the snack's name
int nameSize; // the size of the name field
int count; // the number of snacks of this type
double price; // the price per snack unit
public:
Snack(); // the default constructor
Snack(string); // parameterized constructor
Snack(string,int,double); // parameterized constructor
~Snack(); // the destructor
void setName(string);
void setCount(int);
void setPrice(double);
string getName() const;
string getNameSize() const;
int getCount() const;
double getPrice() const;
}
+++++++++++++++++++++++++++++++++++++++++++
Snack.cpp
// what to include
// The default constructor initializes the string to ""
// and all other fields to 0
Snack();
// This parameterized constructor get the snack's name as
// parameter, intializes the nameSize field accordingly, and
// initializes all other fields to 0
Snack(string);
// This constructor has three parameters: the snack's name,
// its count, and its price. It initializes the nameSize field
// according to the name's size.
Snack(string,int,double);
// The destructor for the Snack class releases memory
// for the object and prints the phrase
// "The snack [snack] has been removed from inventory"
~Snack();
// sets the snack's name and the nameSize fields
void setName(string);
// sets the quantity of snack items
void setCount(int);
// sets the price for the snack
void setPrice(double);
// get the name of the snack
string getName() const;
// get the size of the name field
string getNameSize() const;
// get the count of the snack
int getCount() const;
// get the price for the snack
double getPrice() const;
+++++++++++++++++++++++++++++++++++
Main.cpp
// what to include
int mainMenu();
int adminMenu();
int snackMenu();
bool execute(int,VendingMachine&);
int sanitize(string);
int main(){
// declare a VendingMachines object named thirdFloor,
// whose identifier is L-3rd Floor
// develop a while iteration control structure which
// calls the execute method to operate the machine
// You should add, at least, five different snacks to
// the vending machine's inventory, and demonstrate that
// the vending machine operates properly.
// print the phrase
// "Program developed by [team member 1 name], ID#[team member 1 ID NUMBER HERE],
// and [team member 2 name], ID#[team member 2 ID NUMBER HERE]"
// where the square brackets and the text within must be replaced with your information
return 0;
}
// This method prints the main menu
// The options are:
// 1. Manage the vending machine
// 2. Purchase snacks
// 3. Shutdown the vending machine
int mainMenu(){
}
// This method prints the administrative menu
// where the options are to add a snack, to remove
// a snack, to add more items for an existing snack,
// and to get the total sales.
int adminMenu(){
}
// This method prints the inventory available
// for sale, and returns the selected option value
int snackMenu(){
}
// This method executes the actions from the menu (or menus ???)
// It returns false only if the shutdown action has been requested
bool execute(int){
}
// This methods receives a string and extracts the integer
// value of the selected option.
// The method should return -1 if the parameter contains
// characters other than digits, otherwise returns the
// integer value of the digits
int sanitize(string){
}
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY