Hello, I recently started an intro. to C++ class and am having some issues with a few of the online assignments. My code compiles but is not returning the expected output. I feel like it's an issue with my math but I'm stuck. Can anyone spot what I am doing wrong?
Thanks in advance!
-----------------------------------------------------------
Linda is starting a new cosmetic and clothing business and would like to make a net profit of approximately 10% after paying all the expenses, which include merchandise cost, store rent, employees’ salary, and electricity cost for the store.
She would like to know how much the merchandise should be marked up so that after paying all the expenses at the end of the year she gets approximately 10% net profit on the merchandise cost.
Note that after marking up the price of an item she would like to put the item on 15% sale.
Instructions
Write a program that prompts Linda to enter:
The total cost of the merchandise
The salary of the employees (including her own salary)
The yearly rent
The estimated electricity cost.
The program then outputs how much the merchandise should be marked up (as a percentage) so that Linda gets the desired profit.
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 38 39 40
|
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
double merchCost;
double salary;
double rent;
double electricity;
double expenses;
double markupPrice;
double saleMarkupPrice;
int markupPercent;
cout << "Enter the total cost of the merchandise:" << endl;
cin >> merchCost;
cout << "Enter the salary of the employees (including your own):" << endl;
cin >> salary;
cout << "Enter the yearly rent:" << endl;
cin >> rent;
cout << "Enter the estimated electricity cost:" << endl;
cin >> electricity;
expenses = merchCost + salary + rent + electricity;
markupPrice = (expenses * 0.10);
saleMarkupPrice = (expenses + markupPrice) * 0.15;
markupPercent = (markupPrice + saleMarkupPrice) / ((expenses + markupPrice + saleMarkupPrice) * 100);
cout << "Your merchandise should be marked up " << markupPercent << "%" << endl;
return 0;
}
|