Answer to Question #253029 in C# for Israel

Question #253029

Design a solution that prints the amount of profit an organisation receives based on its sales. The more sales documented, the larger the profit ratio. Allow the user to input the total sales figure for the organisation. Compute the profit based on the following table. Display the sales and profit formatted with commas, decimals, and a rand symbol. Display the profit ratio formatted with a percent symbol. 0 – R1000: 3.0% / R1000.01 – R5000: 3.5% / R5000.01 – R10000: 4.0% / over R10000: 4.5%


1
Expert's answer
2021-10-18T15:07:13-0400
using System;
using System.Collections.Generic;


namespace App
{
   


    class Program
    {
        static void Main(string[] args)
        {


            Console.Write("Enter the total sales figure for the organisation: ");
            double totalSales;
            double.TryParse(Console.ReadLine(), out totalSales);
            double profit=0;
            double profitPerc=0;
            //l. 0 – R1000: 3.0% / R1000.01 – R5000: 3.5% / R5000.01 – R10000: 4.0% / over R10000: 4.5%
            if (totalSales > 0 && totalSales <= 1000) {
                profitPerc = 0.03;
                profit = totalSales *profitPerc;
            }
            if (totalSales > 1000 && totalSales <= 5000)
            {
                profitPerc = 0.035;
                profit = totalSales * profitPerc;
            }
            if (totalSales > 5000 && totalSales <= 10000)
            {
                profitPerc = 0.04;
                profit = totalSales * profitPerc;
            }
            if (totalSales > 10000 )
            {
                profitPerc = 0.045;
                profit = totalSales * profitPerc;
            }




            Console.WriteLine("\nThe sales: {0:N2}", totalSales);
            Console.WriteLine("The profit ({0:P}): {1:N2}\n", profitPerc, profit);


            Console.ReadLine();


        }


    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS