/*
* Hayley Pappas
* Laura Dorcely
* Fernando Valverde
*
* Program that asks the user for their wedding budget & prompt for their wedding expenses
* & outputs whether they're under, at, or over budget.
*
* Input: User's wedding budget, their expenses & the price of those expenses, the number guests
*
* Processing: 1) Intro message
* 2) Prompt user for wedding budget
* 3) Prompt user for number of guests attending wedding
* 4) Menu-driven prompt for user to choose what expense they'd like to add & the price
* switch (choice)
* case 1 - Food per plate
* case 2 - Flowers
* case 3 - Wedding cake
* case 4 - Party favors per person
* case 5 - Entertainment
* case 6 - Photography
* case 7 - Quit
* 5) Display list of expenses & budget results
*
* Output: A list of user's wedding expenses & their prices.
* Diplay a message if they're under, at, or over budget.
*/
#include <iostream>
#include <iomanip>
using namespace std;
// Structure
struct Expenses
{
int weddingGuests;
double budget;
double totalExpenses;
};
int main()
{
// Variables & Constants
Expenses expenses;
double FoodCost(double costPerPlate, int numberOfGuests);
double partyFavorsCost(double partyFavorsPerPerson, int numberOfGuests);
const int FOOD = 1, FLOWERS = 2, CAKE = 3, FAVORS = 4, ENTERTAINMENT = 5, PHOTOGRAPHY = 6, QUIT = 7;
int choice = 0;
double foodPerPlate = 0, flowersCost = 0, cakeCost = 0, partyFavorsPerPerson = 0, entertainmentCost = 0, photographyCost = 0;
// Intro message
cout << "\nWedding Expense Tracker App ..." << endl;
// Prompt user for wedding budget
cout << "\nEnter your wedding budget: ";
cin >> expenses.budget;
// Prompt user for number of guests attending wedding
cout << "Enter the number of guests attending your wedding: ";
cin >> expenses.weddingGuests;
// Menu-driven prompt for user to choose what expense they'd like to add & the price
do
{
cout << "\nPlease choose from the menu which expense you'd like to add (1 - 7):" << endl;
cout << "\t1) Food" << endl;
cout << "\t2) Flowers" << endl;
cout << "\t3) Wedding Cake" << endl;
cout << "\t4) Party Favors" << endl;
cout << "\t5) Entertainment" << endl;
cout << "\t6) Photography" << endl;
cout << "\t7) Quit" << endl;
cout << "Option: ";
cin >> choice;
switch (choice)
{
case FOOD:
cout << "\nEnter food cost per plate: ";
cin >> foodPerPlate;
break;
case FLOWERS:
cout << "\nEnter the cost of flowers: ";
cin >> flowersCost;
break;
case CAKE:
cout << "\nEnter the cost of the wedding cake: ";
cin >> cakeCost;
break;
case FAVORS:
cout << "\nEnter the cost of party favors per person: ";
cin >> partyFavorsPerPerson;
break;
case ENTERTAINMENT:
cout << "\nEnter the cost of entertainment: ";
cin >> entertainmentCost;
break;
case PHOTOGRAPHY:
cout << "\nEnter the cost of photography: ";
cin >> photographyCost;
break;
case QUIT:
break;
default:
cout << "Error ... Invalid option. Try again." << endl;
}
// Total expenses counter
expenses.totalExpenses = FoodCost(foodPerPlate, expenses.weddingGuests) + partyFavorsCost(partyFavorsPerPerson, expenses.weddingGuests) +
flowersCost + cakeCost + entertainmentCost + photographyCost;
} while (choice != QUIT);
// Display list of expenses & budget results
cout << "\n\nWedding Expenses: " << endl;
cout << "***************************************" << endl;
cout << "Food:\t\t\t$" << fixed << setprecision(2) << FoodCost(foodPerPlate, expenses.weddingGuests) << endl;
cout << "Flowers:\t\t$" << fixed << setprecision(2) << flowersCost << endl;
cout << "Wedding Cake:\t\t$" << fixed << setprecision(2) << cakeCost << endl;
cout << "Party Favors:\t\t$" << fixed << setprecision(2) << partyFavorsCost(partyFavorsPerPerson, expenses.weddingGuests) << endl;
cout << "Entertainment:\t\t$" << fixed << setprecision(2) << entertainmentCost << endl;
cout << "Photography:\t\t$" << fixed << setprecision(2) << photographyCost << endl;
cout << "****************************************" << endl;
cout << "Total Expenses:\t\t$" << fixed << setprecision(2) << expenses.totalExpenses << endl;
if (expenses.totalExpenses < expenses.budget)
{
cout << "\nYou're under budget! Fantastic job!!" << endl;
}
else if (expenses.totalExpenses == expenses.budget)
{
cout << "\nYou're at your budget! Great job!" << endl;
}
else
{
cout << "\n\nYou're over budget. Maybe rethink your expenses." << endl;
}
// Outro
cout << "\nThank you for using the Wedding Expense Tracker App! Congrats on your big day!!" << endl;
}
// Calculates total cost of food
double FoodCost(double costPerPlate, int numberOfGuests)
{
return costPerPlate * numberOfGuests;
}
// Calculates total cost of party favors
double partyFavorsCost(double partyFavorsPerPerson, int numberOfGuests)
{
return partyFavorsPerPerson * numberOfGuests;
}