Create two classes and name their types HotdogStand and Money Use initialization
ID: 3909345 • Letter: C
Question
Create two classes and name their types HotdogStand and Money Use initialization sections where possible for all consorucors Only functions that are explicitly intended to wrte to the screen should do so, unless you are printing an error message Money Class Requirements Negative amounts of Noney shall be stored by making both the dollars and cents negative - The Noney class shall have four (4) constructors -A default constructor that initializes your Money object to $0.00 - A constructor that takes two integers, the first for the dollars and the second for the cents This constructor must validate the two integers to ensure that a positive and negative value are not mixed. A value of zero can be considered either positive or negative. If a positive and negative value are provided, a default Money object shall be returned instead A constructor that takes one integer, for an even dolar amount -A constructor that takes one double, and can assign dellars and cents accordingly .int getPennies() const -Returns the equivalent amoum of money held by the calling object as a number of pennies bool isegative) const -Returns true if your amount ofl money is negative The tollowing functions will be removed -NOTE You may wish to keep the logic of some of these functions and move them somewhere else - void add(const Money &) -void subtract(const Money m) - bool isEqual(const Money 6m) const - void print) const The following operators shall be overloaded as member operators Unary minus (negative sign) -Prefx&Posthix; increment Iincrement dollars by one -Prefox&Postfix; decrement (Decrement dollars by one) The following operators shall be overloaded as friend operators - Addition of two Money objects -Multiplication of Money and int -Multiplication of int and Money -Multiplication of Money and double Multiplication of double and Money -Less than or equal to - Greater than - Greater than or equal to - Equalty -Inequality NOTE:All comparative operators shall compare two Money objects Extraction The following operator shal be overloaded as a non-member, non-friend operator Subtraction between two Money objects The Noney class shall have two private data membersExplanation / Answer
main.cpp #include "money.hpp" #include "hotdogStand.hpp" #include #include #include void printRundown(const HotdogStand franchises[], int num); int main() { HotdogStand franchises[10]; double hotdogsPrice; //Money object that represents the price of a hotdog static int totalNumberOfHotdogStand; //static integer that represents the total number of HotdogStand objects static int totalNumberOfHotdogSold; //static integer that represents the total number of hotdogs sold static Money totalRvenueOfHotdogStand; //static Money object that represents total revenue for all HotdogStand objects std::cout 0) { for(int i = totalNumberOfHotdogStand; i > 0; i-- ) { for(int j = 0; jRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.