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


const float originalPrice = 50;
const float markedupRate = 10;
const float cTaxRate = 4;
   int main()
{
    cout << "Enter the original price:                    ";
    float originalPrice;
    cin  >> originalPrice;
    cout << "Enter the marked up rate(percent) :         ";
    float markedupRate;
    cin  >> markedupRate;
    cout << "Enter sales tax :                          ";
    float cTaxRate;
    cin  >> cTaxRate;
    

    float  sellingPrice = originalPrice  *  markedupRate;                       
    float  taxAm         = sellingPrice  *   cTaxRate;
    float  total         = sellingPrice  +   taxAm;    
 
  
    
    

             cout <<  "Enter q and then Enter to quitt --> ";           //
             char dummy; 
             cin >> dummy;                
   // Wait for input
     return 0 ;                            

  
}

what am I doing wrong

Recommended Answers

All 5 Replies

you have to tell us what the problem is. i copied and pasted it into dev C++ and it compiled and ran to conclusion without any compiler or runtime errors.

what is wrong is that you do not display your output. instead of outputting selling price etc you ask the user to enter q and then you end the program without showing the user the output on the screen.

if that is all then all you need to do is display the output but if it is something else then you must tell us what you mean.

whats the use of the const global variables? y r u re-declaring them in main? just think whats the objective of the code, what will be the min number or variables required,their types and usage and then re-write the code.

Maybe you forgot to print the sellingPrice, taxAm and the total. What you did is you just asked the user for the data you needed. I don't know the objective of this program but I guess you need to obtain the sellingPrice blah blah. And oh, chandra.rajat is right, what's the use of the values of the global variables?

you have to tell us what the problem is. i copied and pasted it into dev C++ and it compiled and ran to conclusion without any compiler or runtime errors.

what is wrong is that you do not display your output. instead of outputting selling price etc you ask the user to enter q and then you end the program without showing the user the output on the screen.

if that is all then all you need to do is display the output but if it is something else then you must tell us what you mean.

here it is:
To make a profit, a local store marks up the prices of its items by a certain percentage. Write a C++ program that reads the original price of the item sold, the percentage of the marked-up price, and the sales tax. The program then shall output the original price of the item, the percentage of the mark-up, the store’s selling price of the item, the sales tax rate, the sales tax, and the final price of the item. (The final price of the item is the selling price plus the sales tax)

Your program shall display the following prompts (note the numerical values are input by the user:

Enter the original price of the item: 50
Enter the marked up percentage: 10
Enter the tax rate: 4

Your program shall display the following text with answers (note the numerical values are values computed and maintained by your program):

The original price = $50
The price is marked up by 10%
The selling price = $55
The sales rate = 4%
The sales tax = $2.2
The final price = $57.2

Place this code at the end of your program (just before the return 0 statement) so the program will stop until the character q is typed. This will allow the user to see the values on the screen before the program terminates.

cout << "Press q and then Enter to quit --> "; //
char dummy;
cin >> dummy; // Wait for input

I'll second what Ravenous Wolf had to say:
All you need to do is display the results! (oops)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.