Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C# Programming 9. Design a solution that prints the amount of profit an organiza

ID: 3599465 • Letter: C

Question

C# Programming

9. Design a solution that prints the amount of profit an organization receives based on it sales. The more sales documented, the larger the profit ratio. Allow the user to input the total sales figure for the orga- nization. Compute the profit based on the following table. Display the sales and profit formatted with commas, decimals, and a dollar symbol Display the profit ratio formatted with a percent symbol. 0 $1,000.01- $5,000.01- over $10,000: $1,000: $5,000: $10,000: 3.0% 3.5% 4.0% 4.5% Be sure to design your solution so that all possible situations are accounted for and tested. Use the decimal data type for your solution What values did you enter and test to verify your program's correctness?

Explanation / Answer

using System.IO;
using System;

class Program
{
static void Main()
{
double percentage;
Console.WriteLine("Enter total sales: ");
double totalSales = Double.Parse(Console.ReadLine());
if(totalSales > 10000) {
percentage = 4.5;
} else if (totalSales > 5000 && totalSales <= 10000) {
percentage = 4.0;
} else if (totalSales > 1000 && totalSales <= 5000) {
percentage = 3.5;
} else {
percentage = 3.0;
}
double profit = (percentage * totalSales) /100;
Console.WriteLine("Sales: "+totalSales+", Profit: $"+profit);
}
}

Output: