www.vustudents.ning.com

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

# CS411 Assignment 1 Fall 2021. Due Date= 9 December 2021

(Marks 20)

Problem Statement:

You are required to create a C# Console application using Visual Studio.

Your code should be able to calculate price for sacrificial animals that can be goat, sheep and camel separately while using the concept of POLYMORPHISM.

• Your code should work in such a way that you need to create 3 classes, one parent class i.e. Animal and other three derived classes that will be goat, sheep and camel.
• The function that needs to be override would be of Price Calculation.
• So, your code should work in such a way that at first you should enter the last NUMERIC character of your vu id as a number of animals you want to buy. (Note: You should also check if the last numeric character of your vu id is zero then your code should increment it with 1 so in any case your code should atleast buy one animal). After that, you should be asked for the first five numeric characters of your VUID which will be later used as a rent. Rent will be included in the price of animal that we will hard code.
• Now you need to make a menu/options as shown in the screenshot below, which will ask you if you want to calculate price for the sheep then press 1, if you want to calculate price for goat press 2, if you want to calculate price for camel then press 3, OR if you want to quit simply press 0 (Note: Your Loop should break when user presses 0)
• Your loop should run exactly the same number of times as you have entered for the number of animals you want to buy i.e. last numeric character of your vu id.
• You can use hard-coded values for the price of sheep, goat and camel like 50,000, 80,000, 100,000 respectively.
• Formula to calculate price is: Total Price = rent+price (according to the animal selected)
• Your output should be exactly same as shown in the screenshot below.

Required Output:

Note:

DO REMEMBER that you must use your VUID as an input in this program.

 Submission details Following Files Must be submitted in a single zip or rar file. ·         .cs code file (file name should be your VUID) ·         Screenshot of your output. You are not required to submit the complete project, only copy required file from project folder.

If you do not submit any of the above-mentioned file you will be awarded Marks partially.

“The End”

Views: 637

Attachments:

### Replies to This Discussion

#cs411Assignment1 #VU
CS411 Assignment 1 complete Solution fall 2021

1

2

3

4

5