Question

A street vendor sells three types of juice: apple, grape, and orange. They all sell for...

A street vendor sells three types of juice: apple, grape, and orange. They all sell for $2.49. Ask the vendor how much of each were sold today and then calculate the sales ($) for each. Format your output as shown below, making sure Sales numbers have exactly two decimal places and that all widths / alignments match mine.

Output:

How much apple juice did you sell today? [assume user inputs 5]

How much grape juice did you sell today? [assume user inputs 8]

How much orange juice did you sell today? [assume user inputs 10]

FRUIT QTY SALES($)
Apple 5 12.45
Grape 8 19.92
Orange 10 24.90

-------------------------

1234567890123456789012345 <-- DO NOT output this area. It is here to help you align things.

-------------------------


Solve in C++.

Homework Answers

Answer #1

Please give positive ratings for my effort. Thanks.

PROGRAM

#include<bits/stdc++.h>
using namespace std;

int main()
{
int a,b,c;
cout<<"How much apple juice did you sell today ? ";
cin>>a;
cout<<"\nHow much grape juice did you sell today ? ";
cin>>b;
cout<<"\nHow much orange juice did you sell today ? ";
   cin>>c;
  
   cout<<"\nFRUIT QTY SALES ($) \n";
   cout<<"Apple\t"<<a<<"\t"<<2.49*a<<endl;
   cout<<"Grape\t"<<b<<"\t"<<2.49*b<<endl;
   cout<<"Orange\t"<<c<<"\t"<<2.49*c<<endl;  
   return 0;
}

IMAGE OF OUTPUT

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT