Answered step by step
Verified Expert Solution
Question
1 Approved Answer
convert following python code to C# 11 1 class Toy: 2 def init_(self, topy_id, toy_type, price): 3 self.toy_id=toy_id 4 self.toy_type=toy_type 5 self.price=price I 6 self.Discount_Applicable=0
convert following python code to C#
11 1 class Toy: 2 def init_(self, topy_id, toy_type, price): 3 self.toy_id=toy_id 4 self.toy_type=toy_type 5 self.price=price I 6 self.Discount_Applicable=0 7 class store: 8 def _init_(self, toy_list, discount_details): 9 self.toy_list=toy_list 10 self.dicount_details=discount_details def calculate_discount(self): 12 for i in toy_list: 13 if i.toy_type in self.discount_details.keys(): 14 s=self.discount_details[toy_type] 15 i.Discount_Applicable=i.price*(s/100) 16 else: 17 i.Discount_Applicable=i.price 18 nrint(input()) 19 toy_list=[] 20 k={} 21 for i in range(n): tow id-intlinnut 3 g=seITUISCOUNT_eldis Coy_ypes i. Discount_Applicable=i.price*($/100) else: i. Discount_Applicable=i.price n=int(input()) toy_list=[] for i in range(n): I toy_id=int(input()) toy_type=input() toy_price=int(input()) 5 toy_list.append(Toy(toy_id, toy_type, toy_price)) 5 for i in range(3): key=input() value=int(input()) k[key]=value d=store/toy_list,k) 1 d.calculate_discount() 2 for i in toy_list: print(i.toy_id) 4 print(i..toy price) 55 print(i.toy_Discount_Applicable) 7 8 -3 Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started