Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

how do i do this using C++? In this exercise, we will simulate computing the total of a grocery bill at a small fruit stand.

image text in transcribed

how do i do this using C++?

In this exercise, we will simulate computing the total of a grocery bill at a small fruit stand. The stand sells apples, bunches of bananas, oranges and lemons. Each apple costs $1.25, each bunch of bananas costs $2.25, each orange costs $1.00 and each lemon costs S1.75. Write a program that prompts the user to enter the number of each item (apples, bunches of bananas oranges, and lemons) and computes and reports the total number of items and the total grocery bill in dollars. Make certain that your prompts are reasonably worded. After each prompt, display the total bill for that item, and after all four prompts, display the overall totals. Executing the program might look something like the following: Please enter the number of apples: 2 The total bill for 2 apples is: $2.5 Please enter the number of bunches of bananas: 1 The total bill for 4 bunches of bananas is: $2.25 Please enter the number of oranges: 4 The total bill for 2 oranges is: $4 Please enter the number of lemons: 0 The total bill for 0 lemons is: $0 The total number of items purchased is: 7 The overall total bill is: $8.75 You do not have to account for grammar (e.g. "1 oranges" is fine), the number of decimal spaces after the decimal point, or for the possibility that the user enters a negative number (or invalid input) for the number of a given fruit. You should give your variables reasonable names that reflect their meaning (e.g. num apples to store the number of apples) and your variables should have reasonable types

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

Database Administration The Complete Guide To Dba Practices And Procedures

Authors: Craig S. Mullins

2nd Edition

0321822943, 978-0321822949

More Books

Students also viewed these Databases questions

Question

1. Make sure you can defend the grade in the first place.

Answered: 1 week ago

Question

8. Explain the contact hypothesis.

Answered: 1 week ago

Question

2. Define the grand narrative.

Answered: 1 week ago