The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Issues with my code C#
Program must display the output as follows:
Sales: *the dollar amount of sales made*
Profit Ratio: * the % of profit*
Net Proceeds: *The amount of profit bases on the sales amount*
The Code follows:
using System;
using static System.Console;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Chapter5Program2
{
   class Ch5Program2
   {
       static void Main(string[] args)
       {
           double sales;
           double profit;
           double pr;
           double p;
           //Decimal data tyoe Date Member
           decimal profitratio;
           //Get the input data from the user
           Write("Please enter sales amount: ");
           sales = Convert.ToDouble(ReadLine());
           //Checking the sales range
           //According to this, the profit is caculated
           if (sales <= 1000)
           {
               profitratio = 0.03m;
               //Explicit conversion of dedcimal to double
               pr = (double)profitratio;
               //Calculation of profit
               profit = sales * pr;
               p = pr * 100;
           }
           else if (sales > 1000 && sales <= 5000)
           {
               profitratio = 0.035m;
               pr = (double)profitratio;
               profit = sales * pr;
               p = pr * 100;
           }
           else if (sales > 5000 && sales <= 10000)
           {
               profitratio = 0.04m;
               pr = (double)profitratio;
               profit = sales * pr;
               p = pr * 100;
           }
           else if (sales > 10000)
           {
               profitratio = 0.045m;
               pr = (double)profitratio;
               profit = sales * pr;
               p = pr * 100;
           }
           WriteLine("Sales: $" + sales);
        /*will not display at code is written
         * Â
         *  WriteLine("Profit Ratio: " + pr);
           WriteLine("Net Proceeds: " + p +"%");
           */
       }
   }
}