Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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.

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_2

Step: 3

blur-text-image_3

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

The Temple Of Django Database Performance

Authors: Andrew Brookins

1st Edition

1734303700, 978-1734303704

More Books

Students also viewed these Databases questions

Question

I need help with step by step answers thank you

Answered: 1 week ago

Question

What are the Five Phases of SDLC? Explain each briefly.

Answered: 1 week ago

Question

How can Change Control Procedures manage Project Creep?

Answered: 1 week ago