Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

this language is C# Please note that the numbers in the square brackets [] before the task you are required to do is the number

this language is C#

image text in transcribed

image text in transcribed

image text in transcribed

Please note that the numbers in the square brackets [] before the task you are required to do is the number of points rewarded for the task if done correctly. The maximum number of points is 25. [2] Create a console application called "CartDemo" and add two classes in it: Product and ShoppingCart. You are provided with the content of the "Program.cs" file in the console application. Just click this link to download it. You must use it exactly as is. The class diagrams are shown below. Make sure that your classes conform to them exactly. [2] Create Product class. Product Class Fields basePrice : double price : double :int stockQuantity : int Properties + Name : string + set absent Price : double + set absent> SKU + StockQuantity int Methods + constructor Course (sku: int, stockQuantity: int, basePrice: double) + ToString() string Create the following class members: [1] basePrice is a private read only field representing the base price of the product [1] price is the private field representing current product. It is the dependent on the stock quantity of the product. If the quantity is less then 1000 the current price is 110% of base price, otherwise it is equal to base price. [1] stockQuantity is private field representing the quantity of the product in stock [3] StockQuantity is property that is accessor to stockQuantity field. [1] Name is property representing the name of the product. [1] SKU is read only property representing the stock keep number of the product. [1] Price is read only property that is accessor for price field. [2] A constructor with three parameters: SKU number, number of products in stock, and base price. It assigns them to appropriate members. [1] Create ShoppingCart class Shopping Cart Class Fields cartValue : double Properties + set absent CartValue double + set absent Id : int + set absent> Products : List Methods + AddProduct (product: Product) :void + constructor Shopping Cart(id: int) + ToString() : string Create the following class members: [1] cartValue is a private field representing the total price of all products in the cart and it is based on the current price of the product at the time when it was added to the shopping cart. [1] CartValue is read only property providing the access to the cartValue field. [1] Id is a read only property representing cart id. [1] Products is read only property representing the list of products in the cart. You can create the list as you declare it or in the constructor. [1] A constructor that takes 1 parameter: cart id and assigns the values to appropriates property. [2] AddProduct method has one parameter: product object. The method will add the product to the list of products in the cart, and update the cart value. It also reduces added product stock quantity by 1. [2] ToString() method that generates the string with information about the cart. Make sure that your output matches the one that is provided in the output image of the console result down below. The output must be exactly as provided bellow: The output must be exactly as provided bellow: C. C:\WINDOWS\system32\cmd.exe Total cart 1 value is $1,131.00 with following products: 1 Ball 1 TV 1 Picture Total cart 2 value is $0.00 with following products: Total cart 1 value is $1,131.00 with following products: Ball 1 TV Picture Total cart 2 value is $1,132.00 with following products: Ball TV Picture 1 1 1 1 1 Press any key to continue IMPORTANT: Once you are done, paste the code for each one of the 2 classes you have created in the box below. No file upload is necessary

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

Knowledge Discovery In Databases

Authors: Gregory Piatetsky-Shapiro, William Frawley

1st Edition

0262660709, 978-0262660709

More Books

Students also viewed these Databases questions

Question

What do you mean by Dividend ?

Answered: 1 week ago

Question

What is database?

Answered: 1 week ago

Question

What are Mergers ?

Answered: 1 week ago

Question

3. Write a policy statement to address these issues.

Answered: 1 week ago