Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a simple C++ program to calculate the profit/loss of N products based on their purchase costs, selling prices, and monthly sales. The program should:

Write a simple C++ program to calculate the profit/loss of N products based on their purchase costs, selling prices, and monthly sales. The program should:

Read the number of products N.

Use arrays of length N to store the following: the product names the number of purchases of each product the number of sales made for each product their purchase cost their selling prices the profit or loss incurred from each product Calculate the product profit or loss percentage based on the purchase cost and the sales made: = ( / ) * 100 where, = - = * = *

Also calculate the net profit or loss percentage based on the net profit/loss and the net purchase cost.

Keep track of the product profit/loss based on the three conditions:

If the profit/loss percentage is greater than 0 then mark the product sales as PROFIT.

If the profit/loss percentage is equal to 0 then mark the product sales as BREAK-EVEN.

If the profit/loss percentage is less than 0 then mark the product sales as LOSS.

Sort the products in descending order based on the profit/loss percentage of each product, starting with the most profitable product to the least. MSc CDA Take Home Assignment Pre-Application September 2021

For each product, print (in a tabular format): the product name, the number of purchases, the number of sales, the purchase cost, the selling price, the total purchase cost, the total sales, the overall profit/loss percentage, and the sales indicators.

At the end, print the net purchase cost, the net sales, and the net profit/loss percentage and the profit/loss indicator.

You do not need to worry about having exactly two decimal points and other fancy number formatting

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions