Point of Sale Terminal Notes Write a program that will ask the user for a product number, look up that product number from a table, then display the description and price. This program should ask the...

Need the programming for the attached problem


Point of Sale Terminal Notes Write a program that will ask the user for a product number, look up that product number from a table, then display the description and price. This program should ask the user if the user wants to continue to process another product number. If the user enters 'Y' (upper or lowercase) the program should repeat itself by asking for a product number and looking up that product. This should continue until the user enters a 'N' (upper or lowercase) in which case the program should display the total price of all items looked up and the number of items looked up. Here is an example of how the program should look like when run: POS Terminal - ver 1.0 ---------------------- Enter product number: 1502 No such product. More? (y/n): y Enter product number: 1520 Decoupler, Jansborough - 0.75 More? (y/n): y Enter product number: 1623 Transducer, Drummond - 0.88 More? (y/n): y Enter product number: 1788 Transformer, Smitty - 8.90 More? (y/n): n Total: $10.53 Count: 3 Pay attention to the top and left margins. Also, when this program ends, it should display an blank line for the bottom margin.   Functions Besides the main() function, this program must define and use the following functions: · lookUp() - to look up a product from a table. · formatOutput() - to set up the output stream to display floating-point numbers with two digits past the decimal point. · yesNo() - to ask the user a yes-or-no question. The details for these functions are given below.   bool lookUp(int prodNum, string& description, double& price) This function takes an integer product number and uses it to look up a product from a table. The table must be a switch statement with each case as a product number. The switch statement must then assign the appropriate description and price. Product Number   Description Price 1025 1520 1623 1788 1800 1852 1975   Delimiter, McCormick   Decoupler, Jansborough   Transducer, Drummond   Transformer, Smitty   Doohickey, 12cm   Doohickey, 8cm   Crimper, 5mm 12.99 0.75 0.88 8.90 9.10 8.90 19.99 If the product number is not in the table, the switch should assign "unknown" to the description and zero to the price. If the product number is not found, this function should return false to let the caller know that the product number is not in the table, otherwise this function should return true. I would set up a boolean variable called found and initially set it to true. In the switch statement, if the product number is not in the table, set the boolean variable found to false. At the end of the function, return the boolean variable found.   void formatOutput() This function should set up the output stream to format floating-point values with two digits past the decimal point. This function should not display anything as it does this.   bool yesNo(string prompt) This function should display the given input prompt argument with a " (y/n): " and then get an input string. The code to do this should look something like this: string input; char response; do { cout < " =""  "="">< prompt="">< " (y/n): "; getline( cin, input ); response = toupper( input.at(0) ); } while( response is not 'y' or 'n' ); come up with a logical expression that will check to see if response is not 'y' or 'n'. the toupper() function will convert whatever the user types in from the keyboard to an uppercase letter so you won't have to worry about 'y' or 'n' showing up in response.   the main function i don't want to do the main() function for you, but here is something that is known as pseudo-code that will let me describe what the main() function should do without actually coding it in c++. var prodnum as integer; var description as string; var price as currency; var itemcount as integer = 0; var totalprice as currency = 0.00; formatoutput(); do get prodnum; if lookup( prodnum, description, price ) then      display description and price; add price to totalprice;      add 1 to itemcount; else display "no such product."; endif while yesno( "more?" ); display "total: $" + totalprice; display "count: " + itemcount; note that itemcount is a counter and totalprice is an accumulator. counters and accumulators must be initialized to zero. there is no such data type as currency in c++, but there is a data type that we use for money values--be sure to select the correct c++ data type.   important information when you get the product number from the keyboard, you may have a problem with the yesno() function because of the concepts covered in my notes on mixed input data . the solution is to use cin.ignore() after getting the product number from the keyboard. "="" (y/n):="" ";="" getline(="" cin,="" input="" );="" response="toupper(" input.at(0)="" );="" }="" while(="" response="" is="" not="" 'y'="" or="" 'n'="" );="" come="" up="" with="" a="" logical="" expression="" that="" will="" check="" to="" see="" if response is="" not="" 'y'="" or="" 'n'.="" the="" toupper()="" function="" will="" convert="" whatever="" the="" user="" types="" in="" from="" the="" keyboard="" to="" an="" uppercase="" letter="" so="" you="" won't="" have="" to="" worry="" about="" 'y'="" or="" 'n'="" showing="" up="" in response.=""  ="" the="" main="" function="" i="" don't="" want="" to="" do="" the="" main()="" function="" for="" you,="" but="" here="" is="" something="" that="" is="" known="" as="" pseudo-code="" that="" will="" let="" me="" describe="" what="" the="" main()="" function="" should="" do="" without="" actually="" coding="" it="" in="" c++.="" var="" prodnum="" as="" integer;="" var="" description="" as="" string;="" var="" price="" as="" currency;="" var="" itemcount="" as="" integer="0;" var="" totalprice="" as="" currency="0.00;" formatoutput();="" do="" get="" prodnum;="" if="" lookup(="" prodnum,="" description,="" price="" )="" then=""  =""  =""  display="" description="" and="" price;="" add="" price="" to="" totalprice;=""  =""  =""  add="" 1="" to="" itemcount;="" else="" display="" "no="" such="" product.";="" endif="" while="" yesno(="" "more?"="" );="" display="" "total:="" $"="" +="" totalprice;="" display="" "count:="" "="" +="" itemcount;="" note="" that itemcount is="" a="" counter="" and totalprice is="" an="" accumulator.="" counters="" and="" accumulators="" must="" be="" initialized="" to="" zero.="" there="" is="" no="" such="" data="" type="" as="" currency="" in="" c++,="" but="" there="" is="" a="" data="" type="" that="" we="" use="" for="" money="" values--be="" sure="" to="" select="" the="" correct="" c++="" data="" type.=""  ="" important="" information="" when="" you="" get="" the="" product="" number="" from="" the="" keyboard,="" you="" may="" have="" a="" problem="" with="" the="" yesno()="" function="" because="" of="" the="" concepts="" covered="" in="" my="" notes="" on mixed="" input="" data .="" the="" solution="" is="" to="" use cin.ignore() after="" getting="" the="" product="" number="" from="" the="">
Nov 13, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here