Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hi thanks in advance for helping me with this program. I am really confused on i

ID: 3537999 • Letter: H

Question

Hi thanks in advance for helping me with this program. I am really confused on it and need a code by tomorrow, Sunday at 7 o'clock (6/23/13). This is for the second class with C++. The book we are using is called "C++ Programming: Program Design Including Data Structures" by D.S. Malik. This is Chapter 13 program exercise 18, on page 955.


Below are the 5 files that need to be included, and if you could please title the begining of each section with cashRegister.h or whichever one it is. Please be very explicit with it because I am used to programing with Matlab so I am still trying to learn the exact key words that C++ requires.


Ch13_Ex18_MainProgram.cpp - given file

cashRegister.h

cashRegisterImp.cpp

dispenserType.h

dispenserTypeImp.cpp


This is the question:

Consider the classes cashRegister and dispenserType given in the Programming Example %u2018%u2018Juice Machine%u2019%u2019 in Chapter 10.

In the class cashRegister, add the functions to overload the binary operators + and %u2013 to add and subtract an amount in a cash register; the relational operators to compare the amount in two cash registers; and the stream insertion operator for easy output.

The class dispenserType, in the Programming Example %u2018%u2018Juice Machine%u2019%u2019 in Chapter 10, is designed to implement a dispenser to hold and release products. In this class, add the functions to overload the increment and decrement operators to increment and decrement the number of items by one, respectively, and the stream insertion operator for easy output.

Write a program to test the classes designed in parts a and b.



If you do not have access to the book and can not see the juice machine problem it is talking about, comment in with your email, and I can send you a pdf file of the book, so you will basically get the whole book for free just for helping me out. Thanks again for your help with the 2 header and 2 implementaion codes!




This is the given file for CH13_Ex18_MainProgram.cpp:

********************************************************************************************

#include <iostream>

#include "cashRegister.h"

#include "dispenserType.h"

using namespace std;

void showSelection();

void sellProduct(dispenserType& product,

cashRegister& pCounter);

int main()

{

cashRegister counter;

dispenserType orange(60, 100);

dispenserType apple(70, 100);

dispenserType mango(80, 45);

dispenserType strawberryBanana(100, 85);

int choice; //variable to hold the selection

showSelection();

cin >> choice;

while (choice != 9)

{

switch (choice)

{

case 1:

sellProduct(orange, counter);

break;

case 2:

sellProduct(apple, counter);

break;

case 3:

sellProduct(mango, counter);

break;

case 4:

sellProduct(strawberryBanana, counter);

break;

default:

cout << "Invalid selection." << endl;

}//end switch


showSelection();

cin >> choice;

}//end while

system("pause");

return 0;

}//end main

void showSelection()

{

cout << "*** Welcome to Shelly's Juice Shop ***" << endl;

cout << "To select an item, enter " << endl;

cout << "1 for orange" << endl;

cout << "2 for mango" << endl;

cout << "3 for strawberry banana" << endl;

cout << "4 for Cookies" << endl;

cout << "9 to exit" << endl;

}//end showSelection


void sellProduct(dispenserType& product,

cashRegister& pCounter)

{

int amount; //variable to hold the amount entered

int amount2; //variable to hold the extra amount needed


if (product.getNoOfItems() > 0) //if the dispenser is not

//empty

{

cout << "Please deposit " << product.getCost()

<< " cents" << endl;

cin >> amount;


if (amount < product.getCost())

{

cout << "Please deposit another "

<< product.getCost()- amount

<< " cents" << endl;

cin >> amount2;

amount = amount + amount2;

}


if (amount >= product.getCost())

{

pCounter = pCounter + amount; //.acceptAmount(amount);

product--; //product.makeSale();

cout << "Collect your item at the bottom and "

<< "enjoy." << endl;

}

else

cout << "The amount is not enough. "

<< "Collect what you deposited." << endl;


cout << "*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*"

<< endl << endl;

}

else

cout << "Sorry, this item is sold out." << endl;

}//end sellProduct



********************************************************************************************************************************



Below shows what the program is supposed to look like at the end.


***********************************************************************************************************************


  *Sorry this is long I am just trying to be very informative about the question, if you have any questions you can comment with a way of talking to you and I will answer any questions.

Explanation / Answer

forget about it.

It s done

Please rate me for continous help

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote