Remember the commands that you need to compile g++ program.cpp -o program and run ./program C++ code.
Practice Editing and Compiling Uncle Bob knows that you have been taking computer science classes and wants you to design a program for his small-town grocery store. He doesn't use bar codes and fancy equipment. He just wants to be able to input a cost for an item and whether or not both the taxes are applied to it. He wants the values to be stored so that they can be printed out later. He has drawn up his idea of what he thinks his input and output should look like: cost? 7.70 tax cyn) cost? 5.23 Baxt ya) cost? 3.96 tax? tyn) cost? 11.21 tax? (yi) COST 33 tax? (y) For your review, here are your values Tax 0.00 0.89 6.32 0.00 39.36 2.78 Your total bill Lsi 42.14 0.71 7.10 5.23 3.50 11.21 Your task is to implement Uncle Bob's idea. To keep things simple, you can assume that each "customer" will have five items, and that the "teller" will never make a mistake typing. (O.K, these are pretty unbelievable, but we are trying to keep it simple) Your cousin, Brittany, tried to write the code, but she made six mistakes. If you want to start with her code, you can use the repl link given for this lab. A couple of CS110 labs might come in handy: Lab on one dimensional arrays Lab on outputting with format Remember the commands that you need to compile and run C++ code. lab1 Grocery.cpp Files 5 // Filename: lab1Grocery.cpp 6 // Purpose: To implement Uncle Bob's simple small-town grocery store 7 // calculator as outlined in the programming exercise description. 8 9 #include
10 #include 11 using namespace std; 12 13 const int NUM = 4; 14 15 int main() 16 { 17 // This is for printing money in the proper format with two decimal places 18 cout > Code Console Commands 30- 35 37 42 lab1 Grocery.cpp L Files 29 for (int i=0, i > costArray[0]; 36 // iii. prompt for y and n 38 cout > taxAppliedChar >> endl; 43 // v. if the letter is y, then store the tax into the tax array 44 if (taxAppliedChar = "y") 45 taxArray[i] = costArray[i] * 0.10; 46 } 47 48 // 4. Print (cout) "For your review, here are your values:" with an endl. 49 // Then print some headers for the columns of cost and Tax on a new line 50 51 // 5. Loop five times 52 //i. print the cost and the tax nicely in columns (Hint: try setw(10) 53 //ii. add the current element in the cost array to the "totalCost" 54 //iii. add the current element in the tax array to the "totalTax" >> Code Console Commands lab1Grocery.cpp E G Files 49 // Then print some headers for the columns of Cost and Tax on a new line 50 51 // 5. Loop five times 52 //i. print the cost and the tax nicely in columns (Hint: try setw(10)) 53 //ii. add the current element in the cost array to the "totalCost" 54 //iii. add the current element in the tax array to the "totalTax" 55 56 // 6. Print the "totalCost" and "totalTax" nicely in columns 57 58 // 7. Print a message "Your total bill is:" and the total bill amount 59 60 } 61