Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Remember the commands that you need to compile g++ program.cpp -o program and run ./program c++ code image text in transcribed
image text in transcribed
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? (y) y cost? 5.23 tax? (Y) cost? 8.90 tax? (y) y cost? 11.21 tax? (y) y cost? 6.32 tax? (Y/N) | For your review, here are your values: Cost Tax 7.70 0.77 5.23 0.00 8.90 0.89 11.21 1.12 6.32 0.00 39.36 2.78 Your total bill is: 42.14 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) If you would like, an algorithm is provided here 1. Declare two arrays: one for cost and one for tax 2. Declare additional variables such as letter input (for y or n), and totals for cost and tax. 3. Loop five times i. prompt for cost ii. input the cost into the array iii. prompt for y and n iv. input the y and n v. if the letter is y, then store the tax (cost * .10) into the tax array, otherwise, set the tax array value to 0 4. Print some headers (such as "Cost Tax ") 5. Loop five times i. print the cost and the tax ii. add the current cost (in the array) to a total iii. add the current tax (in the array) to a total 6. Print the cost total and the tax total 7. Print the total bill

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_2

Step: 3

blur-text-image_3

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

Database Technology And Management Computers And Information Processing Systems For Business

Authors: Robert C. Goldstein

1st Edition

0471887374, 978-0471887379

More Books

Students also viewed these Databases questions

Question

Q: Please describe your companys selection process.

Answered: 1 week ago

Question

Know how to use reservations systems to inventory demand.

Answered: 1 week ago