You are on page 1of 13

#include <iostream>

#include <conio.h>

#include <string>

#include <iomanip>

using namespace std;

int band_index, album_index, quantity, amount, answer_index, confirm_reorder, payment;

string band_names[] = { "Sleeping with Sirens", "Mayday Parade"};

string band_album_names_sws[] = {"Madness", "Gossip", "Feel", "Let's Cheers to This", "With Ears to
See and Eyes to Hear"};

double band_album_names_sws_prices[] = {805, 1000, 900, 850, 950};

string band_album_names_mp[] = { "Black Lines", "Valdosta", "Monsters in the Closet", "A Lesson in
Romantics", "Anywhere But Here" };

double band_album_names_mp_prices[] = { 900, 700, 950, 1000, 980 };

int band_names_length = (sizeof(band_names) / sizeof(*band_names));

int band_album_names_sws_length = (sizeof(band_album_names_sws) /


sizeof(*band_album_names_sws));

int band_album_names_mp_length = (sizeof(band_album_names_mp) /


sizeof(*band_album_names_mp));

string purchases = "";

double total_amount = 0;

void show_receipt() {

cout << fixed << setprecision(2);

system("CLS");

cout << " ************************************************************" << endl;


cout << " ***************** S A L E S R E C E I P T *****************" << endl;

cout << " ************************************************************" << endl;

cout << " *** ***" << endl;

cout << " *** ***" << endl;

cout << " *** ***" << endl;

cout << " *** ***" << endl;

cout << " *** " << "You have purchased: ***\n";

cout << " *** ***" << endl;

cout <<purchases<< endl;

cout << " *** ***" << endl;

cout << " *** ***" << endl;

cout << " *** ***" << endl;

cout << " *** ***" << endl;

cout << " ************************************************************" << endl;

cout << " *** ***" << endl;

cout << " *** ***" << endl;

cout << " *** ***" << endl;

cout << " *** ***" << endl;

cout << " *** " << "Total amount: Php " << total_amount << endl;

cout << " *** " << "Amount payed: Php " << payment <<"00"<< endl;

cout << " *** " << "Change: Php " << payment - total_amount<< endl;

cout << " *** ***" << endl;

cout << " *** ***" << endl;

cout << " *** ***" << endl;

cout << " *** ***" << endl;


cout << " *** ***" << endl;

cout << " *** ***" << endl;

cout << " ************************************************************" << endl;

int show_band_names() {

cout << "\nPlease select a band:"<<endl;

for (int counter = 0; counter < band_names_length; counter++) {

cout << "(" << counter + 1 << ") " << band_names[counter] << endl;

cin >> band_index;

if (cin.fail()|| band_index > band_names_length||band_index<1) {

while (cin.fail()) {

cout << endl << "Invalid input!";

cin.clear();

cin.ignore();

cout << endl << "Please select a band: ";

cin >> band_index;

if (band_index > band_names_length||band_index<1) {

do {

cout << endl << "Invalid input!" << endl << "Please select a band: ";

cin >> band_index;


if (cin.fail()) {

while (cin.fail()) {

cout << endl << "Invalid input!";

cin.clear();

cin.ignore();

cout << endl << "Please select a band: ";

cin >> band_index;

} while (band_index > band_names_length || band_index<1);

return band_index;

void show_band_albums(int band_index) {

band_index--;

cout << "\nYou have selected " << band_names[band_index] << "." << endl << endl;

cout << "Select an album to purchase:" << endl;

// sleeping with siren

if (band_index == 0) {

int album_length = (sizeof(band_album_names_sws) /


sizeof(*band_album_names_sws));

for (int counter = 0; counter < album_length; counter++) {


cout << "(" << counter + 1 << ") " << band_album_names_sws[counter] << " -
Php " << band_album_names_sws_prices[counter] << endl;

cout << endl << "Enter your order: ";

cin >> album_index;

if (cin.fail()) {

while (cin.fail()) {

cout << endl << "Invalid input!";

cin.clear();

cin.ignore();

cout << endl << "Please select an album: ";

cin >> album_index;

album_index--;

if (album_index >= band_album_names_sws_length|| album_index<1) {

do {

cout << endl << "Invalid input!" << endl << "Please select an album: ";

cin >> album_index;

album_index--;

if (cin.fail()) {

while (cin.fail()) {

cout << endl << "Invalid input!\n";

cin.clear();

cin.ignore();
cout << endl << "Please select an album: ";

cin >> album_index;

album_index--;

} while (album_index >= band_album_names_sws_length || album_index<1);

cout << endl << "You have selected " << band_album_names_sws[album_index];

cout << "\n\nHow many album would you like to avail? ";

cin >> quantity;

if (cin.fail()) {

while (cin.fail()) {

cout << endl << "Invalid input!\n";

cin.clear();

cin.ignore();

cout << "How many album would you like to avail? ";

cin >> quantity;

purchases += " *** " + band_album_names_sws[album_index] +"("+ + ":\n" + "


*** x" + to_string(quantity) + " " + "Php " +
to_string(quantity*band_album_names_sws_prices[album_index]) + "\n *** \n";

total_amount += band_album_names_sws_prices[album_index] * quantity;


cout << endl << "Do you want to purchase more?\n" << "(1) Yes\n" << "(2) No" << endl;

cin >> confirm_reorder;

if (cin.fail() || (confirm_reorder != 1 || confirm_reorder != 2)) {

while (cin.fail()) {

cout << endl << "Invalid input!";

cin.clear();

cin.ignore();

cout << endl << "Do you want to purchase more?\n";

cin >> confirm_reorder;

if (confirm_reorder >2|| confirm_reorder<1) {

do {

cout << endl << "Invalid input!" << endl << "Do you want to purchase
more?\n";

cin >> confirm_reorder;

if (cin.fail()) {

while (cin.fail()) {

cout << endl << "Invalid input!";

cin.clear();

cin.ignore();

cout << endl << "Do you want to purchase more?\n ";

cin >> confirm_reorder;


}

} while (confirm_reorder > 2 || confirm_reorder<1);

if (confirm_reorder == 1) {

int reorder_band_index;

reorder_band_index = show_band_names();

show_band_albums(reorder_band_index);

else if (confirm_reorder == 2) {

cout << endl << "Total amount: Php " << total_amount << endl << endl << "Enter
amount of payment: Php ";

cin >> payment;

if (cin.fail()||(payment < total_amount)) {

do {

cin.clear();

cin.ignore();

cout << "Invalid input!\n" << "Enter amount of payment: Php ";

cin >> payment;

} while (cin.fail() || (payment < total_amount));

cout << "\nChange: Php " << payment - total_amount << ".00";

}
}

/*mayday parade*/

else if (band_index == 1) {

int album_length = (sizeof(band_album_names_mp) /


sizeof(*band_album_names_mp));

for (int counter = 0; counter < album_length; counter++) {

cout << "(" << counter + 1 << ") " << band_album_names_mp[counter] << " -
Php " << band_album_names_mp_prices[counter] << endl;

cout << endl << "Enter your order: ";

cin >> album_index;

if (cin.fail()) {

while (cin.fail()) {

cout << endl << "Invalid input!\n";

cin.clear();

cin.ignore();

cout << "Please select an album: ";

cin >> album_index;

album_index--;

if (album_index >= band_album_names_mp_length || album_index<1) {

do {
cout << endl << "Invalid input.\n" << "Please select an album: ";

cin >> album_index;

album_index--;

if (cin.fail()) {

while (cin.fail()) {

cout << endl << "Invalid input!\n";

cin.clear();

cin.ignore();

cout << "Please select an album: ";

cin >> album_index;

album_index--;

} while (album_index >= band_album_names_mp_length || album_index<1);

cout << endl << "You have selected " << band_album_names_mp[album_index];

cout << "\n\nHow many album would you like to avail? ";

cin >> quantity;

if (cin.fail()) {

while (cin.fail()) {

cout << endl << "Invalid input!\n";

cin.clear();

cin.ignore();
cout << "How many album would you like to avail? ";

cin >> quantity;

int price = quantity * band_album_names_mp_prices[album_index];

purchases += " *** " + band_album_names_mp[album_index] + ":\n" + " ***


x" + to_string(quantity) + " " + "Php " +
to_string(quantity*band_album_names_mp_prices[album_index]) + "\n *** \n";

total_amount += band_album_names_mp_prices[album_index] * quantity;

cout << endl << "Do you want to purchase more?\n" << "(1) Yes\n" << "(2) No" << endl;

cin >> confirm_reorder;

if (cin.fail() || (confirm_reorder != 1 || confirm_reorder != 2)) {

while (cin.fail()) {

cout << endl << "Invalid input!";

cin.clear();

cin.ignore();

cout << endl << "Do you want to purchase more?\n";

cin >> confirm_reorder;

if (confirm_reorder >2 || confirm_reorder<1) {

do {
cout << endl << "Invalid input!" << endl << "Do you want to purchase
more?\n";

cin >> confirm_reorder;

if (cin.fail()) {

while (cin.fail()) {

cout << endl << "Invalid input!";

cin.clear();

cin.ignore();

cout << endl << "Do you want to purchase more?\n ";

cin >> confirm_reorder;

} while (confirm_reorder > 2 || confirm_reorder<1);

if (confirm_reorder == 1) {

int reorder_band_index;

reorder_band_index = show_band_names();

show_band_albums(reorder_band_index);

else if (confirm_reorder == 2) {

cout << endl << "Total amount: Php " << total_amount << endl << endl << "Enter
amount of payment: Php ";

cin >> payment;

if (cin.fail() || (payment < total_amount)) {

do {
cin.clear();

cin.ignore();

cout << "Invalid input!\n" << "Enter amount of payment: Php ";

cin >> payment;

} while (cin.fail() || (payment < total_amount));

cout << "\nChange: Php " << payment - total_amount;

int main () {

cout << "Welcome to Good Sheet!\n";

band_index = show_band_names();

show_band_albums(band_index);

show_receipt();

_getch();

return 0;

You might also like