Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

using the source codes at the bottom of the page Serendipity Booksellers Software Development Project Part 5: A Problem-Solving Exercise 1.Data Validation Modification In Part

using the source codes at the bottom of the page

Serendipity Booksellers Software Development Project Part 5: A Problem-Solving Exercise

1.Data Validation Modification

In Part 4 of this project you used if statements in each module to validate the input. Modify the code to use while loops instead.

2.The Main Menu

Item four on the Main Menu is Exit, which allows the user to end the program. Add a loop to the mainmenu.cpp program that causes it to repeatedly display the menu until the user selects item four.

3.The Inventory Database Menu

Item five on the Inventory Database Menu is Return to the Main Menu. When the project is complete, this item will cause the program to branch back to the main menu. For now, add a loop to the invmenu.cpp program that causes it to repeatedly display the menu until the user selects item five.

4.The Reports Menu

Item seven on the Reports Menu is Return to the Main Menu. When the project is complete, this item will cause the program to branch back to the main menu. For now, add a loop to the reports.cpp program that causes it to repeatedly display the menu until the user selects item seven.

5.The Cashier Module

After the user has entered the data for a sale and the simulated sales slip is displayed, add code that asks the cashier if another transaction is to be processed. If so, the program should repeat.

mainmenu.cpp

#include

#include

using namespace std;

int main()

{

cout<<"\t Serendipity Booksellers" <

cout<<"\t Main Menu"<

cout<<"\t 1. Cashier Module" <

cout<<"\t 2. Inventory Database Module" <

cout<<"\t 3. Report Module" <

cout<<"\t 4. Exit" << endl;

cout<<"\t Enter Your Choice: ";

int choice = 0;

while(1)

{

cin>>choice;

if(choice<1 || choice>4)

{

cout<<"\t Please enter a number in the range 1 - 4."<

cout<<"\t Enter Your Choice: ";

}

else

break;

}

switch(choice)

{

case 1:

cout<<"\t You selected item 1";

break;

case 2:

cout<<"\t You selected item 2";

break;

case 3:

cout<<"\t You selected item 3";

break;

case 4:

cout<<"\t You selected item 4";

break;

}

return 0;

}

reports.cpp

#include

#include

using namespace std;

int main()

{

cout<<"\t Serendipity Booksellers" <

cout<<"\t Reports"<

cout<<"\t 1. Inventory Listing" <

cout<<"\t 2. Inventory Wholesale Value" <

cout<<"\t 3. Inventory Retail Value" <

cout<<"\t 4. Listing by Quantity " << endl;

cout<<"\t 5. Listing by Cost " << endl;

cout<<"\t 6. Listing by Age " <

cout<<"\t 7. Return To Main Menu:"<

cout<<"\t Enter Your Choice: ";

int choice = 0;

while(1)

{

cin>>choice;

if(choice<1 || choice>7)

{

cout<<"\t Please enter a number in the range 1 - 7."<

cout<<"\t Enter Your Choice: ";

}

else

break;

}

switch(choice)

{

case 1:

cout<<"\t You selected item 1";

break;

case 2:

cout<<"\t You selected item 2";

break;

case 3:

cout<<"\t You selected item 3";

break;

case 4:

cout<<"\t You selected item 4";

break;

case 5:

cout<<"\t You selected item 5";

break;

case 6:

cout<<"\t You selected item 6";

break;

case 7:

cout<<"\t You selected item 7";

break;

}

return 0;

}

invmenu.cpp

#include

#include

using namespace std;

int main()

{

cout<<"\t Serendipity Booksellers" <

cout<<"\t Inventory Database"<

cout<<"\t 1. Look Up a Book" <

cout<<"\t 2. Add a Book" <

cout<<"\t 3. Edit a Book's Record" <

cout<<"\t 4. Delete a Book" << endl;

cout<<"\t 5. Return to the Main Menu"<

cout<<"\t Enter Your Choice: ";

int choice = 0;

while(1)

{

cin>>choice;

if(choice<1 || choice>5)

{

cout<<"\t Please enter a number in the range 1 - 5."<

cout<<"\t Enter Your Choice: ";

}

else

break;

}

switch(choice)

{

case 1:

cout<<"\t You selected item 1";

break;

case 2:

cout<<"\t You selected item 2";

break;

case 3:

cout<<"\t You selected item 3";

break;

case 4:

cout<<"\t You selected item 4";

break;

case 5:

cout<<"\t You selected item 5";

break;

}

return 0;

}

Modified cahier.cpp Program

#include #include #include using namespace std; int main() { string date, ISBN, Title; int numOfBook; double price, subtotal, tax, total;

cout<<"\tSerendipity Booksellers"<> ws, date); cout<<"Quantity of Book: "; cin >> numOfBook; cout<< "ISBN: "; getline (cin >> ws, ISBN); cout<< "Title: "; getline (cin >> ws, Title); cout<< "Price: "; cin >> price; subtotal = numOfBook * price; tax = 6 * subtotal / 100; total = subtotal + tax; // setting to 2 decimal places in fixed point notation cout << fixed << setprecision(2); cout <

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essentials of Database Management

Authors: Jeffrey A. Hoffer, Heikki Topi, Ramesh Venkataraman

1st edition

133405680, 9780133547702 , 978-0133405682

More Books

Students also viewed these Databases questions

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago