Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C-Sharp Create a new class, in a separate file, called ElectricScooterBundle . The file name should be ElectricScooterBundle.cs. Add the following properties: Id (int), Scooter

C-Sharp

Create a new class, in a separate file, called ElectricScooterBundle. The file name should be ElectricScooterBundle.cs. Add the following properties: Id (int), Scooter (ElectricScooter) and Accessories (List). Add a constructor that takes the id and scooter. Add a ToString method that outputs the bundle id, scooter and bundle price. Add a CalculateTotal method that calculates and returns the total price of scooter and all selected accessories. Write a program in Problem5 method that lets the user select one scooter and as many accessories as they wish, then create an ElectricScooterBundle object, add the accessories to the bundle object and print the bundle object. Be sure to use the methods and classes created previously to help solve the problem.

(I have most of the code (download the link below to get the c# file) I need help matching the "sample run"

Sample run: Electric Scooter: number: 1 name: E Prime Electric Scooter color: Silver run time:30 price 379.99 Electric Scooter: number: 2 name: Power A2 Electric Scooter color: Silver run time:40 price 199.99 Electric Scooter: number: 3 name: E300 Electric Scooter color: Blue run time: 40 price 279.99 Electric Scooter: number: 4 name: RX200 Electric Scooter color: Green run time: 40 price 269.99 select number 2 You selected: Power A2 Electric Scooter Add an accessory (Y/N)? y Accessory: number: 1 name: Adult Helmet color: Black price 24.99 Accessory: number: 2 name: Child Helmet color: Black price 19.99 Accessory: number: 3 name: Foam Grips color: Blue price 9.99 Accessory: number: 4 name: Child Elbow & Knee Pads color: Pink price 19.99 select number 2 Add an accessory (Y/N)? Y Accessory: number: 1 name: Adult Helmet color: Black price 24.99 Accessory: number: 2 name: Child Helmet color: Black price 19.99 Accessory: number: 3 name: Foam Grips color: Blue price 9.99 Accessory: number: 4 name: Child Elbow & Knee Pads color: Pink price 19.99 select number 3 Add an accessory (Y/N)? Y Accessory: number: 1 name: Adult Helmet color: Black price 24.99 Accessory: number: 2 name: Child Helmet color: Black price 19.99 Accessory: number: 3 name: Foam Grips color: Blue price 9.99 Accessory: number: 4 name: Child Elbow & Knee Pads color: Pink price 19.99 select number 4 Add an accessory (Y/N)? N Electric Scooter Bundle: number: 1 Scooter: Electric Scooter: number: 2 name: Power A2 Electric Scooter color: Silver run time:40 price 199.99 bundle price 249.96 Accessory: number: 2 name: Child Helmet color: Black price 19.99 Accessory: number: 3 name: Foam Grips color: Blue price 9.99 Accessory: number: 4 name: Child Elbow & Knee Pads color: Pink price19.99

image text in transcribed

image text in transcribed

Please download this .ZIP file (link) with the c# file (code) that I have worked with some code.

https://www.dropbox.com/s/3cudftjdepsyw5k/Assignment-Lab-09.zip?dl=0

DebugDefault 2017 for Msc Program.c Console.WriteLine(item.Value. ToString)); 127 128 129 130 131 132 133 134 135 136 137 138 139 148 Packagos Propartias /taking user input Console.Write("Enter Accessory number to select: "); int input = Convert.ToInt32 (Console.ReadLine()); if (dictionary.ContainsKey(input)) Console.WriteLine("Invalid entry, try again"): return ChooseElectricScooterFromDictionary(dictionary); else return dictionary[inputl; //Console.WriteLine(selectedScoot); 142 143 144 145 146 147 148 149 158 151 152 153 154 155 156 157 158 159 160 public static void Problem5() //write a program in Problem5 method that lets the user select one scooter and as many accessories as they wish, //then create an ElectricScooterBundle object, add the accessories to the bundle object and print the bundle object //Be sure to use the methods and classes created previously to help solve the problem Dictionarycint, ElectricScooter> dictionaryofElectricscooter LoadElectricScooter; ElectricScooter selectedScooter-ChooseElectricScooterFromDictionarydictionaryofElectricscooter); ListcAccessory> accessoryList new List) Dictionarycint, Accessory> dictionaryOfAccessories LoadAccessories); string continueAdding "Yes"; do Accessory acc -ChooseAccessoryFromDictionary(dictionaryOfAccessories); accessoryList.Add(acc); Console.WriteLine("Press Yes if you want to continue adding accessories, else press No"); continueAdding Consote.ReadLine); 162 163 164 165 166 167 168 169 170 while (continueAdding. Equals( "Yes")); Elect Console.WriteLine(bundle.ToString)); //Console.Writeline(scootBundle; ooterBundle bundle - new ElectricScooterBundle(selectedScooter, accessoryList, 1 172 173 174 " Solunian using Systen; using Systen.Callections.Generic; using Systen.Ling using Systen.Text using Systen. Threading.Tasks; 13 nanespace AssignmentLab09 public class ElectricScooterBundle 17 Mnebers of this class private int ID; private Electricscooter scooter private List Accessory accessories; /Constructor of this class public ElectricScooterBundle(ElectricScooter scooter, List

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

Data Analysis Using SQL And Excel

Authors: Gordon S Linoff

2nd Edition

111902143X, 9781119021438

More Books

Students also viewed these Databases questions