Question

im not sure why my code isnt working? include <iostream> #include <iomanip> using namespace std; int...

im not sure why my code isnt working?

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

int main()
{
int amountOfCoffee;
double Price;
char salesTaxChargeability;
double TotalAmount;
const double SALESTAX = 0.035; // 3.5 %

cout << "\nEnter the number of pounds of coffee ordered in Pounds :";
cin >> amountOfCoffee;
cout << "\nEnter the price of coffee per Pound :";
cin >> Price;
cout << "\nIs sales tax Chargeable (y or n): ";
cin >> salesTaxChargeability;
if ( (salesTaxChargeability == 'y') || (salesTaxChargeability == 'Y') )
TotalAmount = (amountOfCoffee * Price) + (SALESTAX * (amountOfCoffee * Price));
else
TotalAmount = (amountOfCoffee * Price);
cout << "\n\n Total amount the customer owes : " << setprecision(8) << TotalAmount;
cout << "\n\n Thank you for using the applicable.. Goodbye" << endl;
}

0 0
Add a comment Improve this question Transcribed image text
Answer #1

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

int main()
{
   int amountOfCoffee;
   double Price;
   char salesTaxChargeability;
   double TotalAmount;
   const double SALESTAX = 0.035; // 3.5 %
  
   cout << "\nEnter the number of pounds of coffee ordered in Pounds :";
   cin >> amountOfCoffee;
   cout << "\nEnter the price of coffee per Pound :";
   cin >> Price;
   cout << "\nIs sales tax Chargeable (y or n): ";
   cin >> salesTaxChargeability;
   if ((salesTaxChargeability == 'y') || (salesTaxChargeability == 'Y'))
       TotalAmount = (amountOfCoffee * Price) + (SALESTAX * (amountOfCoffee * Price));
   else
       TotalAmount = (amountOfCoffee * Price);
   cout << "\n\n Total amount the customer owes : " << setprecision(8) << TotalAmount;
   cout << "\n\n Thank you for using the applicable.. Goodbye" << endl;
}

Add a comment
Know the answer?
Add Answer to:
im not sure why my code isnt working? include <iostream> #include <iomanip> using namespace std; int...
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
  • #include <iostream> #include <vector> #include <iomanip> using namespace std; int main() { const int NUM_ITEMS =...

    #include <iostream> #include <vector> #include <iomanip> using namespace std; int main() { const int NUM_ITEMS = 8; vector <double> inverse(NUM_ITEMS); int j; double temp; for (int i = 0; i < NUM_ITEMS; i++) { inverse.at(i) = 1 / (i + 1.0); } cout << fixed << setprecision(2); cout << "Original vector..." << endl; for (int i = 0; i < NUM_ITEMS; i++) { cout << inverse.at(i) << " "; } cout << endl; cout << "Reversed vector..." << endl; for...

  • my program wont run on my computer and im not understanding why. please help. #include<iostream> #include<iomanip>...

    my program wont run on my computer and im not understanding why. please help. #include<iostream> #include<iomanip> #include<string> #include "bookdata.h" #include "bookinfo.h" #include "invmenu.h" #include "reports.h" #include "cashier.h" using namespace std; const int ARRAYNUM = 20; BookData bookdata[ARRAYNUM]; int main () { bool userChoice = false; while(userChoice == false) { int userInput = 0; bool trueFalse = false; cout << "\n" << setw(45) << "Serendipity Booksellers\n" << setw(39) << "Main Menu\n\n" << "1.Cashier Module\n" << "2.Inventory Database Module\n" << "3.Report Module\n"...

  • Use this code to create multiple functions. #include<iostream> #include<iomanip> #include<fstream> using namespace std; int main() {...

    Use this code to create multiple functions. #include<iostream> #include<iomanip> #include<fstream> using namespace std; int main() { cout << fixed << showpoint << setprecision(2); ofstream outFile; outFile.open("Feras's.txt"); outFile << "..Skinny Feras's Restaurant ..\n\n" << endl; int choise=10, quantity; float paid, SubTotal=0, Tax = .10, Total, RM, more; while(choise!=0) { system("cls"); cout << "\t**Welcome To Skinny Alsaif Restaurant Lol**" << endl; cout << "\nWhat would you like to have?" << endl; cout << "1. Burger." << endl; cout << "2. Pizza." <<...

  • #include <iostream> #include <chrono> using namespace std; double improvedPow(double x, int y) { // To be...

    #include <iostream> #include <chrono> using namespace std; double improvedPow(double x, int y) { // To be implemented by you } int main() { cout << "To calculate x^y ..." << endl; double x; int y; cout << "Please enter x: "; cin >> x; cout << "Please enter y: "; cin >> y; if(x == 0) { if (y > 0) cout << 0 << endl; else cout << "x^y is not defined" <<endl; } else { cout << improvedPow(x,y)...

  • Why is this not giving me a letter grade when run? #include <iostream> #include <iomanip> using...

    Why is this not giving me a letter grade when run? #include <iostream> #include <iomanip> using namespace std; int main() { double grade1, grade2, grade3, grade4, total; cout << "please enter the first grade : "; cin >> grade1; cout << "Please enter the second grade : "; cin >> grade2; cout << "Please enter the third grade : "; cin >> grade3; cout << "Please enter the fourth grade : "; cin >> grade4; total = (grade1 + grade2...

  • what is the output for the following code? explain the steps. /*#include <iostream> using namespace std;...

    what is the output for the following code? explain the steps. /*#include <iostream> using namespace std; int f(int &i) { i = 10; return(5 * i); } int main() { int n = 5; f(n); cout << n << "\n"; return 0; } #include <iostream> using namespace std; int sub1(int n) { n--; return n; } int main() { int m = 10; for(int j = 0; j < 10; j++) m -= sub1(j); cout << m << "\n"; return...

  • This is C++ code for parking fee management program #include <iostream> #include <iomanip> using namespace std;...

    This is C++ code for parking fee management program #include <iostream> #include <iomanip> using namespace std; void input(char& car, int& ihour,int& imin, int& ohour, int& omin); void time(char car, int ihour, int imin, int ohour, int omin, int& phour, int& pmin, int& round, double& total); void parkingCharge (char car, int round, double& total); void print(char car, int ihour, int imin, int ohour, int omin, int phour, int pmin, int round, double total); int main() { char car; int ihour; int...

  • #include <iostream> #include <cmath> #include <iomanip> #include <cstdlib> using namespace std; bool isInt (double value) {...

    #include <iostream> #include <cmath> #include <iomanip> #include <cstdlib> using namespace std; bool isInt (double value) {     double dummy;     return bool(modf(value, &dummy) == 0); } double sqr(double value) { return value * value; } double calcFrictionFactor(double R, double D, double epsilon) {     const double BlasiusCoefficient = 0.3164;     double f_old, f_new;     f_new = BlasiusCoefficient * pow(R, -0.25); // loop until our two values are within 0.000001 of each other     do {   f_old = f_new; // previous guess is now the old one...

  • #include <iostream> #include <conio.h> #include<limits> using namespace std; int main(){ char oparand, ch = 'Y'; int...

    #include <iostream> #include <conio.h> #include<limits> using namespace std; int main(){ char oparand, ch = 'Y'; int num1, num2, result; while(ch == 'Y'){ cout << "Enter first number: "; cin >> num1; while(1){//for handling invalid inputs if(cin.fail()){ cin.clear();//reseting the buffer cin.ignore(numeric_limits<streamsize>::max(),'\n');//empty the buffer cout<<"You have entered wrong input"<<endl; cout << "Enter first number: "; cin >> num1; } if(!cin.fail()) break; } cout << "Enter second number: "; cin >> num2; while(1){ if(cin.fail()){ cin.clear(); cin.ignore(numeric_limits<streamsize>::max(),'\n'); cout<<"You have entered wrong input"<<endl; cout <<...

  • #include "stdafx.h" #include <iostream> using namespace std; class dateType {    private:        int dmonth;...

    #include "stdafx.h" #include <iostream> using namespace std; class dateType {    private:        int dmonth;        int dday;        int dyear;       public:       void setdate (int month, int day, int year);    int getday()const;    int getmonth()const;    int getyear()const;    int printdate()const;    bool isleapyear(int year);    dateType (int month=0, int day=0, int year=0); }; void dateType::setdate(int month, int day, int year) {    int numofdays;    if (year<=2008)    {    dyear=year;...

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