Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The file DebugFour4.cs has syntax and/or logical errors. Determine the problem(s), and fix the program. // Program computes sales commission based on the following: //

The file DebugFour4.cs has syntax and/or logical errors. Determine the problem(s), and fix the program.

// Program computes sales commission based on the following: // Sales up to and including $1,000 -- 5% commission // Up to and including $5,000 -- 5% on first $1,000 and // 7% commission on amount over $1,000 // up to and including $10,000 -- same as before plus $1,000 bonus // over $10,000 - same as all of the above plus // additional $1,500 bonus using System; using System.Collections.Generic; using System.Linq; using System.Text;

namespace Debugging { public class DebugFour4 { static void Main() {

double sales = 0, commission = 0; string inputString; const int LOWSALES = 1000; const int MEDSALES = 5000; const int HIGHSALES = 10000; const double LOWPCT = 0.05; const double MEDPCT = 0.07; const int BONUS1 = 1000; const int BONUS2 = 1500;

Console.WriteLine("What was the sales amount? "); inputString = Console.ReadLine(); sales = Convert.ToDouble(inputString);

if (sales <= LOWSALES) commission = (LOWSALES * LOWPCT); else if (sales > LOWSALES && sales <= MEDSALES) commission = (LOWSALES * LOWPCT) + (sales - LOWSALES) * MEDPCT; else if (sales <= HIGHSALES) commission = (LOWSALES * LOWPCT) + (sales - LOWSALES) * MEDPCT + BONUS1; else if (sales > HIGHSALES) commission = (LOWSALES * LOWPCT) + (sales - LOWSALES) + BONUS2; else commission = (LOWSALES * LOWPCT) + (sales - LOWSALES) * MEDPCT + BONUS2;

Console.WriteLine("Sales: {0} Commission: {1}", sales.ToString("C"), commission.ToString("C"));

Console.ReadKey(); } }

}

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

Recommended Textbook for

More Books

Students also viewed these Databases questions