Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- The Fruit Problem:
- Deliverable
- 1. This solution should only require a single file using the https://dotnetfiddle.net/ .Net Fiddle online compiler.
- 1. Currently you should use the compiler Roslyn 4.8
- 2. The solution must run with no errors.
- 3. Once complete, please use the "Share" function to send us the Url to your solution.
- Instructions
- Create a console application that allows the user to put different types of fruit into a basket. Using inheritance, create at least 5 types of specific fruits (e.g. Apple, Banana, Pear, Orange, Grape) and define those classes as subclasses from Fruit.
- 1. Each Fruit object has the following fields/properties:
- 1. Color
- 2. Weight
- 3. Price
- 2. Each specific fruit can have additional fields/properties.
- 1. Be creative and add at least 1 field to each individual, specific fruit class.
- 2. Examples:
- 1. Apple can have a field AppleSubtype, which can hold the appleās subtype (e.g. Granny Smith).
- 2. Banana can have a field called Length.
- 3. Grapes can have a field for number of grapes on one vine.
- The user has a basket (probably an array or list) that can hold 10 items.
- The user is asked how many of each Fruit they want to add to the basket, until either the basket is full, or each fruit has been offered to the user. Once the basket is full or the user chooses not to add 10 items, let the user know what the total weight of the basket is, and what the total price of the fruits is.
- You can decide yourself on the weights and the prices, but use somewhat appropriate numbers.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement