Math problem in dev c++

Here is the scenario: A local bookstore buys books at a certain cost from a wholesaler. The store then marks up the price by a certain percentage and adds sales tax to it. The marked up price plus the sales tax is what the customer will pay for a given book. Write a program to get from the user the cost of the book, the mark up percentage, and the sales tax rate. Then the program should calculate the mark up amount, the sales tax and the price the customer will pay.

Cost:$50.00 with mark up percentage 10% and sales tax rate 5%
Cost: $25.00 with mark up percentage 5% and sales tax rate 10%
Cost:$100.00 with mark up percentage rate 8% and sales tax rate 3%.

Here is what I did. Please let me know what I did wrong.

// Rebecca Carolina Katz
//Filename: lab3.cpp
//Lab 3
//calculating the markup amount, the sales tax, and price the customer has to pay for books.

include <iostream>
using namespace std;

int main ()
{
// variable declaration
int num1;
int num2;
int num3;
int markupPercent;
int Salestax;
int average;

cout <<"Rebecca Carolina Katz, Lab #3" << endl;

// Get all values for input variables
num1=50.00;
markupPercent=num1*0.10
salesTax=num1*0.05
average=num1*0.10*0.05
cout << num1*0.10*0.05<< endl;

num2=25.00
markupPercent=num2*0.05
salesTax=num2*.10
average=num2*0.05*0.10
cout << average=num2*0.05*0.10<< endl;

num3=100.00
markupPercent=num3*0.08
salesTax=num3*0.03
average=num3*0.08*0.03;
cout << average=num3*0.08*0.03

return 0;

}
Last edited on
Well, try to compile and run your program
And thnk you forgot to outputin the value that being calulated in program
I did and I got an error for where I said salesTax=num1*0.05. It says not declared..
Its SalesTax in variable declaration, but you're usng salesTax
ok now I have this:

#include <iostream>
using namespace std;

int main ()

{
// variable declaration
int num1;
int num2;
int num3;
int markupPercent;
int SalesTax;
int average;

cout <<"Rebecca Carolina Katz, Lab #3" << endl;

// Get all values for input variables
num1=50.00;
MarkupPercent=num1*0.10;
SalesTax= num1*0.05;
average=num1*0.10*0.05;
cout << num1*0.10*0.05<< endl;

num2=25.00;
MarkupPercent=num2*0.05;
SalesTax=num2*.10;
average=num2*0.05*0.10;
cout << average=num2*0.05*0.10<< endl;

num3=100.00;
MarkupPercent=num3*0.08;
SalesTax=num3*0.03;
average=num3*0.08*0.03;
cout << average=num3*0.08*0.03;

return 0;

} But now I am getting these errors. Sorry I don't mean to be a pain but I am really new to programming:
27 2 E:\Lab_3Katz.cpp [Error] 'MarkupPercent' was not declared in this scope
36 35 E:\Lab_3Katz.cpp [Error] invalid operands of types 'double' and '<unresolved overloaded function type>' to binary 'operator<<'

42 17 E:\Lab_3Katz.cpp [Error] no match for 'operator=' (operand types are 'std::basic_ostream<char>' and 'double')
Study the code and figure out what it does

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <iostream>

using namespace std;

int main ()

{

float num1, num2, num3;
float markupPercent;
float salesTax;
float average;

cout <<"Rebecca Carolina Katz, Lab #3" << endl;

// Get all values for input variables
num1 = 50.00;
markupPercent = num1 * 0.10;
salesTax = num1 * 0.05;
average = num1 + markupPercent + salesTax;
cout << average << endl;

num2 = 25.00;
markupPercent = num2 * 0.05;
salesTax = num2 * 0.10;
average = num2 + markupPercent + salesTax;
cout << average << endl;

num3 = 100.00;
markupPercent = num3 * 0.08;
salesTax = num3 * 0.03;
average = num3 + markupPercent + salesTax;
cout << average << endl;

return 0;

}


Your code was a bit messy I cleaned it
Last edited on
Topic archived. No new replies allowed.