Question

using c++ do a machine soda, that show me each time that i put a quarter,...

using c++ do a machine soda, that show me each time that i put a quarter, then tell me is not enough, show me this till I put a dollar in there, at the end show me how much i sell
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Note: Could you plz go through this code and let me know if u need any changes in this.Thank You
_________________


#include <fstream>
#include <iostream>
#include <iomanip>
using namespace std;

int main() {
   double quarter,amt=0,totAmt=0;
   char ch;
  
   cout<<"** Soda Machine **"<<endl;
  
   while(true)
   {
   cout<<"\nEnter amount to get soda :$";
   while(true)
   {
   cin>>quarter;
   amt+=quarter;
   if(amt<1)
   {
       cout<<"** Amount not enough **"<<endl;
       cout<<"Enter more amount :$";
      
   }
   else
   {
       totAmt+=amt;
       cout<<"Take your Soda,Enjoy."<<endl;
       amt=0;
       break;
   }  
   }
   cout<<"Do you want to get another soda (y/n)?";
   cin>>ch;
   if(ch=='y'||ch=='Y')
{

   continue;

}else
{
break;
}  
   }
  
   cout<<"\nTotal amount earned :$"<<totAmt<<endl;
  
  
   return 0;
}

_____________________

// Output:

_________________Thank You

Add a comment
Know the answer?
Add Answer to:
using c++ do a machine soda, that show me each time that i put a quarter,...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • i dont need no explanation just tell me the number to put in each box no...

    i dont need no explanation just tell me the number to put in each box no need to show work just give the number that gies in each box QUESTION 8 How many grams of lithium nitrate will be needed to make 200.0 grams of lithium sulfate, assuming that you have an adequate amount of lead (IV) sulfate to do the reaction? How much lead (IV) sulfate will you actually need? 363.229 Pb(SO4)2 + 4 LINO3 -> Pb(NO3)4 + 2...

  • using c++ i need a program like university enrollment, that tell me any information i need,...

    using c++ i need a program like university enrollment, that tell me any information i need, for example if the teacher (administrator) wants to know how many students are on each class he select, in case if the student is trying to access so then the studen put his name on it and select the course and at the end shows how many credits en etc

  • Can someone show me how to do the math for this question. I use a TI-84...

    Can someone show me how to do the math for this question. I use a TI-84 plus calculator. Thank you. You can afford to pay $5,000 per month for a personal loan to establish your business. The interest rate is 2.25% for a 15-year fixed loan. a. How much can your borrow? Round to the nearest dollar. b. How much is the total payment? Round to the nearest dollar. c. How much is the interest? Round to the nearest dollar.

  • Assume that each soda can arrives at the packaging station according to a Poisson process with...

    Assume that each soda can arrives at the packaging station according to a Poisson process with = 15 cans per minute, and that a batch of four cans is made instantly (taking ignorable time) by an automated machine. (a) What is the mean time until a batch is formed? (b) What is the standard deviation of the time until a batch is formed? (c) What is the probability that a batch is formed in less than 16 seconds? Pepper One...

  • Can you help me solve this question, but also show me how to properly put the...

    Can you help me solve this question, but also show me how to properly put the formulas/equations in Excel? I tried and I am getting the wrong answer. Thank you Assume you have a balance of $1300 on a credit card with an APR of 15%, or 1.25% per month. You start making monthly payments of $200, but at the same time you charge an additional $70 per month to the credit card. Assume that interest for a given month...

  • please show me what to put in the TVM solver in addition to solving the problem...

    please show me what to put in the TVM solver in addition to solving the problem TVM: N= I%= PV= PMT= FV= P/Y= C/Y= 1. When Jack started his job working for an industrial manufacturing company, he contributed $240 at the end of each month into a savings account that earned 2.3 % interest compounded monthly for 6 years. At the end of the 6th year, Jack was laid off. To help meet family expenses, Jack withdrew $250 from the...

  • USING TVM SOLVER IN CALCULATOR ONLY (TI 83-84) plz show me how to do it in...

    USING TVM SOLVER IN CALCULATOR ONLY (TI 83-84) plz show me how to do it in the calculator (TVM) Sarah secured a bank loan of $175,000 for the purchase of a house. The mortgage is to be amortized through monthly payments for a term of 15 years, with an interest rate of 3%/ year compounded monthly on the unpaid balance. She plans to sell her house in 5 years. How much will Sarah still owe on her house at that...

  • Piece #3 (1 pt): I put an ice cube in my soda. If the ice cube...

    Piece #3 (1 pt): I put an ice cube in my soda. If the ice cube gains 1000 J of heat, how much heat does the soda lose? Piece #4 (1 pt): How much energy would be required to raise the temperature of 1.00 kg of water from 20°C to 45°C? Piece #5 (1 pt): How much electrical energy would I need to raise the temperature of 1.00 kg of water from 20°C to 45°C if my heater was only...

  • I put this as my answer and it was graded wrong. Please show me how to...

    I put this as my answer and it was graded wrong. Please show me how to answer Be sure to answer all parts. Give the IUPAC name for the following compound. 3 methyl 6 isopropyl Ynonane

  • You are planning to put $3,500 in the bank at the end of each year for...

    You are planning to put $3,500 in the bank at the end of each year for the next eight years in hopes that you will have enough money for a down payment on a condo. If you are investing at an annual interest rate of 9%, how much money will you have at the end of eight years--rounded to the nearest whole dollar? O $102,179 O $112,490 O $93,742 O $74.994 You've decided to deposit your money in the bank...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT