/*
Programmer: Jennifer Leopold
File: hw6_functs.h
Purpose: This file contains the function prototypes for
the HW #6 vending machine program.
*/
#ifndef HW6_H
#define HW6_H
#include <iostream>
#include <cstdlib>
#include <string>
using namespace std;
// ******************************************************
// Constants
// Menu selections
const string MENU_ITEM_1 = "Ginko Root";
const string MENU_ITEM_2 = "Mandrake Root";
const string MENU_ITEM_3 = "Ginseng Root";
const string MENU_ITEM_4 = "Square Root";
const string MENU_ITEM_5 = "Vitamin R Root";
const string MENU_ITEM_QUIT = "Quit";
const int NUM_MENU_ITEMS = 6;
// Price for each menu item
const float MENU_ITEM_1_PRICE = 4.5;
const float MENU_ITEM_2_PRICE = 1.23;
const float MENU_ITEM_3_PRICE = 2.39;
const float MENU_ITEM_4_PRICE = 99.98;
const float MENU_ITEM_5_PRICE = 0.78;
// Initial quantity of each menu item
const int MENU_ITEM_1_QTY = 5;
const int MENU_ITEM_2_QTY = 12;
const int MENU_ITEM_3_QTY = 12;
const int MENU_ITEM_4_QTY = 12;
const int MENU_ITEM_5_QTY = 12;
const string OUT_OF_STOCK = " *NO LONGER AVAILABLE* ";
const int NUM_MENU_SELECTION_COMMENTS = 7;
// Snarky error messages
const string ATTENTION_MSG = "Can't you read? It says";
const string TRY_AGAIN1 = "Sigh...let's try this again.";
const string TRY_AGAIN2 =
"Take a deep breath and think VERY carefully.";
const string TRY_AGAIN3 =
"Really...would that make sense on ANY planet?";
const string TRY_AGAIN4 =
"Out of curiosity, are you related to Ralph Wiggum?";
// Sales tax rates
const float TAX_RATE_SMALL_PURCHASES = 0.5;
const float TAX_RATE_MED_PURCHASES = 0.27;
const float TAX_RATE_LARGE_PURCHASES = 0.02;
const float SMALL_PURCHASE_LIMIT = 100;
const float MED_PURCHASE_LIMIT = 300;
// Amount that program multiplies user's desired qty by
const int QUANTITY_MULTIPLIER = 2;
// ******************************************************
// Function prototypes
// Generate a random number within a specified range.
// Preconditions: Parameter low is <= parameter high.
// Postconditions: A value >= low and <= high is returned.
int myRand(const int low, const int high);
// Display a greeting to the user and get input for his/her
// name.
// Preconditions: None
// Postconditions: The user's name is returned.
string greetUser();
// Display a sign-off message to the user.
// Preconditions: Parameter customerName contains the name of
// the customer, which will be included in the sign-off message.
// Postconditions: A sign-off message has been output to the
// screen.
void signOff(const string customerName);
// Display a menu of vending item selections.
// Preconditions: Parameters numMenu1..numMenu5 contain the
// available quantities of the respective menu items.
// Postconditions: A menu has been output to the screen. If
// an item is no longer available, a message to that effect has
// been output next to that selection.
void displayMenu(const int numMenu1, const int numMenu2,
const int numMenu3, const int numMenu4,
const int numMenu5);
// Prompt the user to enter a menu selection. This may be
// overridden by a selection randomly made by the program.
// Preconditions: None
// Postconditions: A valid menu selection is returned and a
// snarky comment randomly selected by the program has been
// displayed on the screen.
int getMenuSelection();
// Generate a snarky message about a specified menu choice.
// Preconditions: Parameter menuChoice should contain a (possibly
// invalid) menu selection.
// Postconditions: A snarky message about a menu choice
// will be returned.
string randomMenuChoiceMsg(const int menuChoice);
// Prompt the user to enter a quantity of an item. This may be
// overridden by a selection randomly made by the program.
// Preconditions: Parameter numAvailable is the amount of the
// selected item that is available, and itemName is the name
// of the selected item.
// Postconditions: An amount > 0 and <= numAvailable is returned
// and a snarky comment randomly selected by the program has
// been displayed on the screen.
int getQuantityInput(const int numAvailable,
const string itemName);
// Make a snarky comment based on comparing the quantity that
// computer is suggesting vs. the quantity that the user wants.
// Preconditions: Parameters computerQty and userQty contain
// non-negative values.
// Postconditions: A snarky comment randomly selected by the
// program has been displayed on the screen.
void commentOnQuantity(const int computerQty, const int userQty);
// Add tax to the total charges on items purchased.
// Preconditions: Parameter total contains a (non-negative)
// amount representing the total cost of items purchased.
// Postconditions: Pass-by-reference parameter total has been
// modified to include tax.
void applyTax(float &total);
// Prompt the user to enter payment for his/her total purchases
// and output change due.
// Preconditions: Parameter total should contain a non-negative
// amount representing total purchases plus tax, and customerName
// should contain the user's name.
// Postconditions: A message about change that the user is due
// (following payment) will have been displayed on the screen.
void getPaid(const float total, const string customerName);
#endif