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

Using C# 1. Assume that you have a retail store with inventory. Once a month, yo

ID: 3692710 • Letter: U

Question

Using C#

1. Assume that you have a retail store with inventory. Once a month, you adjust pricing for items that have been in stock for more than 90 days, discounting inventory items priced under $500.00 by 10 percent and higher-priced items by 20 percent. Higher-priced items have an additional profit margin.

2. Make a new console application and add System.Threading.Tasks to the using statements if it is not already listed there.

3. Define an integer array that contains pricing of items in stock more than 90 days. int[] inventoryList ={100, 750, 400, 75, 900, 975, 275, 750, 600, 125, 300};

4. In the Main method, define a Parallel.For loop to enumerate the inventory. a. Parallel.For( 0, inventoryList.Length, (index) => { // your code goes here b. Now insert your code for the parallel operation. Define a temporary variable to hold the price of the current inventory item. If the price is greater than $500.00, apply a 20 percent discount. Otherwise, use a 10 percent discount. //your code goes here c. Insert a Console.WriteLine in the function to display the adjusted price as it is calculated }

5. After the loop has completed its processing, use a normal (non-parallel) loop to display the prices as they exist in the array.

Explanation / Answer

Answer 1

using System;

namespace Inventory

{

class InventoryDiscount

{

static void Main(string[] args)

{

int price;

int discountAmount;

int y;

int result;

Console.Write(" Enter item Price: ");

price=Convert.ToInt32(Console.ReadLine());

if price <500:

discountAmount = price*(10/100);

else if (price > 500 and price<1000):

discountAmount = price * (20/100);

  

Console.Write(" The discountAmount is: "+discountAmount);

Console.ReadLine();

}

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote