Algorithms are used all the time today to solve problems, even if people are not aware they are using them. Algorithms break down one big problem into many smaller problems or steps that can be more easily solved. One such problem in the business that can be solved with algorithms is how much profit are they making based on the sales of a product. The algorithm can be as follows:
Step 1: How many of the product has been sold?
Step 2: What is the price of each product?
Step 3: Calculate the total sales income by multiplying the number of products sold by the cost of each product
Step 4: How much does it cost to make the product?
Step 5: Calculate total expense by multiplying cost to make one product by the number of products sold
Step 6: Calculate profit by subtracting total expense from total income.
Respond to the following in a minimum of 100 words:
Can you write an algorithm as a list of steps?
Algorithm: Calculate_Profit
[ N is the number of the product has been sold, Cost is the price of each product, Total-sales is the total sales income, Make-cost is the cost to make the product, Total-expense is the total expense of the N products, Profit is the total profit on the sales of the N products ]
Step 1: Start [Start of the algorithm]
Step 2: Input N [Input the number of the product has been sold ]
Step 3: Input Cost [Input the cost is the price of each product ]
Step 4: Total-sales = N x Cost [Calculate the total sales income]
Step 5: Input Make-cost [Input the cost to make the product,]
Step 6: Total-expense = N x Make-cost [Calculate total expense ]
Step 7: Profit = Total-sales - Total-expense [Calculate profit ]
Step 8: Print Profit [Print/Output the profit]
Step 9: End [End of the algorithm]
Get Answers For Free
Most questions answered within 1 hours.