45.1k views
2 votes
N this lab, you complete a partially written c program that is provided for you. the program, which was written for a furniture company, prints the name of the furniture item, its retail price, its wholesale price, the profit made on the piece of furniture, a sale price, and the profit made when the sale price is used. instructions ensure the provided file named is open. the file includes variable declarations and output statements. read them carefully before you proceed to the next step. design the logic and write the c code that will use assignment statements to: calculate the profit (profit) as the retail price minus the wholesale price calculate the sale price (saleprice) as 25 percent deducted from the retail price calculate the sale profit (saleprofit) as the sale price minus the wholesale price. execute the program by clicking the run button. your output should be as follows: item name: tv stand retail price: $325 wholesale price: $200 profit: $125 sale price: $243.75 sale profit: $43.75

User Mtfurlan
by
8.0k points

1 Answer

3 votes

Final answer:

To code the logic for calculating profit, sale price, and sale profit in a C program, use assignment statements to find the differences between retail and wholesale prices and apply a discount for the sale price.

Step-by-step explanation:

In the context of a partially written C program for a furniture company, the necessary code to calculate the profit, sale price, and sale profit from given retail and wholesale prices is as follows:

To calculate the profit, subtract the wholesale price from the retail price:

profit = retailPrice - wholesalePrice;

To calculate the sale price, deduct 25 percent from the retail price:

salePrice = retailPrice * 0.75;

Lastly, to calculate the sale profit, subtract the wholesale price from the sale price:

saleProfit = salePrice - wholesalePrice;

When you execute the program with a retail price of $325 and a wholesale price of $200, your output will match the provided example, with a profit of $125, a sale price of $243.75, and a sale profit of $43.75.

User Brendalee
by
7.2k points