The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Answer the questions about C#, please help me ASAP, thank you!
The standard sec±on covers crea±ng simple classes, composi±on, inheritance, LINQ, excep±onsand wri±ng fles. The problem domain is the online ordering oF items. The main problem is thecalcula±on oF shipping costs to get the total price oF an order. You can do it all using a consoleapplica±on.Standard1. (0.5 marks) Write the code for a simple class Item(a) It should have properTes an item ID, name, price and weight (in grams). (b) It should have adefault constructor and a non-default constructor (c) It should have a ±oString method whichcontains all the item details on a single line.2. (0.5 marks) Write the code for a simple class Address(a) It should have properTes for a street, a suburb, a postcode, and a state and a country. (b) Itshould have a default constructor which fully iniTalizes the address. (c) It should have a non-default constructor which creates an empty address. (d) It should have a ±oString method whichreplaces the default method from the object class and returns a string containing anappropriately forma²ed address.3. Write the code for a class Customer(a) It should have properTes for a customer ID, name, password, shipping address and billingaddress (note, don’t rewrite the Address code - the addresses should be of type Address). (b) Itshould have a default constructor and a non-default constructor (c) It should have a ±oStringmethod which returns a string containng the name and customer ID. E.g. ”Angela Piper(#123456)”4. (2 marks) Write classes to represent two diFerent types of ShippingCalculator: Parcel andExpress. You should create an appropriate base class with two virtual methods, one for theshipping price (a decimal) and one for the esTmated delivery Tme (a string). Both methodsshould take an the source address and a desTnaTon address, the shipping price also takes theitem weight.(a) ³or a Parcel, the shipping price is $8.50 for items weighing up to 500g, $13.80 for itemsweighing up to 3000g, and $17.60 up to 5000g for delivery within the same country. ³or deliverybetween diFerent countries the price is 3 Tmes the normal price. If the item weighs more than5000g, an excepTon should be thrown with the message “Cannot ship objects over 5kg usingparcel post”. (b) ³or an Express delivery, the shipping price is $0.02 Tmes the item weight fordelivery within the same country and same postcode, $0.03 Tmes the item weight for deliverywithin the same country and diFerent postcodes, and $0.07 Tmes the item weight forinternaTonal deliveries. (c) ³or a Parcel delivery, the esTmated delivery Tme is 3-4 days withinthe same state, 5-6 days within the same country (diFerent states), and approx. 21 days fordiFerent countries. (d) ³or an Express delivery, the esTmated delivery Tme is 1 day within thesame state, 4 days within the same country (diFerent states), and approx. 14 days for diFerentcountries.5. In main, create an address object to represent the store locaTon, create a Customer object anda list of items ordered by the customer. Ensure that at least one item weighs less than 5000g andat least one item weighs more than 5000g. Use LINQ to print the items which weigh less than5kg. Use LINQ to print the total price of items which weigh less than 5kg (not including theshipping price).26. Using LINQ where you can, print the total price of all items, the total shipping cost andesTmated Tme using parcel delivery and the total shipping cost and esTmated Tme using expressdelivery. Catch any excepTons and report an appropriate error message. Allow the user to chooseeither postal or express delivery.
Attachments: