Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Follow the //TODO: and //comment instructions to complete this assignment using System; namespace ShoeStore { class Program { static void Main(string[] args) { // menu

Follow the //TODO: and //comment instructions to complete this assignment

using System;

namespace ShoeStore { class Program { static void Main(string[] args) { // menu Console.WriteLine("Hello World!, Welcome to my shoe store"); Console.WriteLine("We have the following shoes available to purchase:");

Console.WriteLine("12000 Men's UA HOVR Havoc 2 Basketball - $120 - buy 4 get one free"); Console.WriteLine("12001 Women's UA HOVR Breakthru Basketball Shoes - $110 -buy one get one 1/2 price"); Console.WriteLine("12002 Men's Nike KD Trey 5 VIII - $90 - "); Console.WriteLine("12003 Men's Nike Air Max Impact Basketball Shoes - $95"); Console.WriteLine("12004 Nike Air Huarache - Women's - $99.99");

// instantiate shoe objects Shoe s1 = new Shoe("12000", "Men UA HOVR Havoc 2 Basketball", 120.00m, 0); Shoe s2 = new Shoe("12001", "Women UA HOVR Breakthru Basketball Shoes", 110.00m, 0); Shoe s3 = new Shoe("12002", "Men Nike KD Trey 5 VIII", 90.00m, 0); Shoe s4 = new Shoe("12003", "Men Nike Air Max Impact Basketball Shoes", 95.00m, 0); Shoe s5 = new Shoe("12004", "Nike Air Huarache", 99.99m, 0);

// loop control variable bool keepBuyingShoes = true;

// accumulation variables int numShoe1 = 0; int numShoe2 = 0; int numShoe3 = 0; int numShoe4 = 0; int numShoe5 = 0;

decimal totalSaleAmount = 0m;

// process user input while (keepBuyingShoes == true) { // ask user for sku and quantity Console.WriteLine("Enter shoe SKU: "); String sku = Console.ReadLine(); Console.WriteLine("Enter quantity: "); int quantity = int.Parse(Console.ReadLine());

// process quantity per sku,TODO:make this structure more efficient // TODO: tell the user sku is invalid if that is the case

if (sku == s1.SKU) { numShoe1 += quantity; } if (sku == s2.SKU) { numShoe2 += quantity; } if (sku == s3.SKU) { numShoe3 += quantity; } // TODO: add up for shoe 4 and shoe 5

// ask user to continue.... Console.WriteLine("Do you want to buy more shoes? (Yes/No): "); String answer = Console.ReadLine(); if (answer == "yes" || answer == "YES" || answer == "Yes") { keepBuyingShoes = true; } else { keepBuyingShoes = false; }

}

// TODO:process discounts and total price .. // does this process need to be fixed for better efficiency ? keep the for loops

for (int i = 0; i < numShoe1; i++) { totalSaleAmount = totalSaleAmount + s1.Price; } for (int i = 0; i < numShoe2; i++) { totalSaleAmount = totalSaleAmount + s2.Price; } for (int i = 0; i < numShoe3; i++) { totalSaleAmount = totalSaleAmount + s3.Price; } for (int i = 0; i < numShoe4; i++) { totalSaleAmount = totalSaleAmount + s4.Price; } for (int i = 0; i < numShoe3; i++) { totalSaleAmount = totalSaleAmount + s5.Price; }

// print invoice Console.WriteLine($"Total price is: {totalSaleAmount:C} "); } } }

//Shoe Class

using System; namespace ShoeStore { public class Shoe { String sku; String name; Decimal price; Double size;

public String SKU { get; set;} public String Name { get; set; }

public Decimal Price { get { return price; } set { // TODO:make sure price is valid before setting,, you determine yourself what you think a valid price is price = value; } }

// TODO: add a public property for size, with a get /set and make sure the size is between 4 - 16

public Shoe() {

} public Shoe(String sku, String name, Decimal price, Double size) { SKU = sku; Name = name; Price = price; // TODO: how would you change the line below once you add the public property for size this.size = size;

} public String toString() { return ""; } } }

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

Database Processing Fundamentals Design And Implementation

Authors: KROENKE DAVID M.

1st Edition

8120322258, 978-8120322257

More Books

Students also viewed these Databases questions

Question

25.0 m C B A 52.0 m 65.0 m

Answered: 1 week ago