What is the correct answer for this program? Kinda new to programming. I need help.
Program Description:
Cashier 1.0 is a C++ program that displays on the screen “Sweet and minty Lollipops! How many would you want to buy?” Then, the user enters the quantity. Moreover, it displays the text, “You have bought [quantity] Sweet and minty Lollipops! Please pay, PhP [Amount due]. ” Then, the user will enter the amount of cash. Finally, it will display a summary of the transaction by displaying the amount due, VAT (12%), VATable amount, amount of cash and the change.
Each lollipop costs PhP 5.00.
//for example you bought 7 lollipops
Sample Run:
Sweet and minty Lollipops! How many would you want to buy? 7
You have bought 7 Sweet and minty Lollipops! Please pay PhP 35.00.
Please examine the transaction details below: (this transaction detail should display on the program)
cout<<"Welcome to Minty Lollipops!"<<endl;
cout<<"Sweet and minty Lollipops! How many would you want to buy?"<<endl;
cin>>i;
cout<<"You have bought"<< i <<"Minty Lollipops"<<"Please pay"<< VatableAmount <<endl;
int AmountofCash;
cout<<"Enter Amount of Cash"<<endl;
cin>> AmountofCash;
This is my changed program. The AmountDue does not produce the right value. What do you think is wrong?
#include <iostream>
using namespace std;
int main()
{
//declarations
double Price = 5;
int i;
long double AmountDue;
double VatableAmount;
double Vat;
Vat = Price*0.12;
double VatRate = 0.12;
//AmountDue = i*Price;
cout<<"Welcome to Minty Lollipops!"<<endl;
cout<<"Sweet and minty Lollipops! How many would you want to buy?"<<endl;
cin>>i;
AmountDue = ((i*Price)*VatRate)+Price;
VatableAmount = AmountDue-Vat;
cout<<"You have bought"<< i <<"Minty Lollipops"<<"Please pay"<< AmountDue <<endl;
int AmountofCash;
cout<<"Enter Amount of Cash"<<endl;
cin>> AmountofCash;