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

Need help with this in C# Code is as follows: // Program gets a quanity ordered

ID: 3738813 • Letter: N

Question

Need help with this in C# Code is as follows:

// Program gets a quanity ordered from user
// then determines price and discount based on quantity
// price per item before discounts is $6.00
// order 15 or more, get a 20% discount
// order 10 to 14 - get a 14% discount
// order 5 to 9, get a 10% discount
using System;
using static System.Console;
class DebugSeven3
{
static void Main()
{
int quantity;
double price;
quantity = GetQuantity();
price = CalculatePrice(quantity);
Console.WriteLine("Final price for {0} items is {1}.",
quantity, price.ToString("c"));
}
private static int GetQuantity() //** added int return type
{
int quan;
Console.Write("Enter number of items >> ");
quan = Convert.ToInt32(Console.ReadLine());
return quan; //** added this line
}
private static double CalculatePrice(int quantityOrdered) //** added double return type and made it static
{
double PRICE_PER_ITEM = 6.00;
double price = 0;
double discount = 0;
int[] quanLimits = {0, 5, 10, 15}; //** added closing curly brace
double[] limits = {0, 0.10, 0.14, 0.20}; //** added closing curly brace
for(int x = limits.Length - 1; x >= 0; --x)
if(quantityOrdered >= quanLimits[x]) //** changed to quanLimits & placed curly braces around following 2 statements
{  
discount = limits[x];
x = 0;
}
price = quantityOrdered * PRICE_PER_ITEM;
price = price - price * discount;
return price;
}
}

+DebugSeven3.cs Instructions 1 V/ Program gets a quanity ordered from user 2 // then determines price and discount based on quantity The provided file has syntax and/or logical errors. Determine the problem(s) and fix the progranm 3 // price per item before discounts is $6.00 4 // order 15 or more, get a 20% discount 5 // order 10 to 14 - get a 14% discount 6 // order 5 to 9, get a 10% discount GRADING 7 using Systen; 8 using static System.Console; As you complete the steps above, you carn use the Test button to check if the lab tests are passing. Once you are satisfied with the results, use the Grade button to save your score 9 class DebugSeven3 10 11 static void Mainc) 12 13 14 15 16 17 18 19 20 private static int GetQuantity() /** added int return type 21 int quantity; double price; quantity-GetQuantity); price CalculatePrice(quantity); Console.WriteLine(" Final price for o items is {1].", quantity, price.ToString("c 23 24 25 int quan; Console.Write( Enter number of itens"; quanConvert.ToInt32 (Console.ReadLine(); return quan added this line Run Code Test Grade

Explanation / Answer

I am going to mention every correcton in the bold letters

using System;

using static System.Console;

class Debug2_7

{

   static void Main()

   {

      int quantity;

      double price;

      quantity = GetQuantity();

      price = CalculatePrice(quantity);

      WriteLine("Final price for {0} items is {1}.",

        quantity, price.ToString("c"));

   }

   private static int GetQuantity()

   {

      int quan;

      Write("Enter number of items>> ");

      quan = Convert.ToInt32(ReadLine());

return quan;

   }

   private static double CalculatePrice(int quantityOrdered)

   {

int x;

       double PRICE_PER_ITEM = 6.00;

       double price = 0;

       double discount = 0;

       int[] quanLimits = {0, 5, 10, 15};

       double[] limits = {0, 0.10, 0.14, 0.20};

       for(x = limits.Length - 1; x >= 0; --x) //x declared in the loop can not be used outside the loop thats why i //declared it in the beging

if(quantityOrdered >= limits[x])

              discount = limits[x];

              x = 0;

       price = quantityOrdered * PRICE_PER_ITEM;

       price = price - price * discount;

       return price;

   }

}