Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Debugging { public class DebugFour 4 { static void Main ( ) { / / Declare

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Debugging
{
public class DebugFour4
{
static void Main()
{
// Declare and initialize variables and constants
double sales =0, commission =0; // Variables for storing sales and commission amounts
string inputString; // Variable for storing user input as a string
const int LOWSALES =1000; // Lower sales threshold
const int MEDSALES =5000; // Medium sales threshold
const int HIGHSALES =10000; // Higher sales threshold
const double LOWPCT =0.05; //5% commission rate
const double MEDPCT =0.07; //7% commission rate
const int BONUS1=1000; // $1,000 bonus
const int BONUS2=1500; // $1,500 bonus
// Prompt user for sales amount
Console.WriteLine("What was the sales amount? ");
inputString = Console.ReadLine();
sales = Convert.ToDouble(inputString); // Convert string input to a double
// Evaluate sales amount and calculate commission
if (sales <= LOWSALES)
commission = sales * LOWPCT; //5% on sales up to $1,000
else if (sales > LOWSALES && sales <= MEDSALES)
commission =(LOWSALES * LOWPCT)+(sales - LOWSALES)* MEDPCT; //5% on first $1,000 and 7% on amount over $1,000 up to $5,000
else if (sales > MEDSALES && sales <= HIGHSALES)
commission =(LOWSALES * LOWPCT)+(MEDSALES - LOWSALES)* MEDPCT + BONUS1; // Additional $1,000 bonus for sales up to $10,000
else if (sales > HIGHSALES)
commission =(LOWSALES * LOWPCT)+(MEDSALES - LOWSALES)* MEDPCT + BONUS1+ BONUS2; // Additional $1,500 bonus for sales over $10,000
Console.WriteLine("Sales: {0}
Commission: {1}", sales.ToString("C"), commission.ToString("C"));
Console.ReadKey();
}
}
}
The file DebugFour4.cs has syntax and logical errors. Determine the problem(, and fix the program code.

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

From Herds To Insights Harnessing Data Analytics For Sustainable Livestock Farming

Authors: Prof Suresh Neethirajan

1st Edition

B0CFD6K6KK, 979-8857075487

More Books

Students also viewed these Databases questions

Question

1. Effort is important.

Answered: 1 week ago