VU Answer Provide Latest CS411 Assignment No 1 Solution Fall 2021. Easy to See Correct Complete CS411 Assignment 1 Solution 2021 and Download PDF.

## CS411 ASSIGNMENT 1 SOLUTION FALL 2021

Due Date: 9 Dec 2021

Total Marks: 20

Note:

Use your Own VU ID in the program.

Assignment Submission:

Submit your assignment in .zip and .rar file only

Screenshot of your output program with our vu id.

CODE Solution:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace method_overriding

{

class Animal

{

public int rent_of_anmal;

public Animal(int rentOfAnimal)

{

this.rent_of_anmal = rentOfAnimal;

}

public virtual int price_calculation(int price)

{

return rent_of_anmal + price;

}

class horse : Animal

{

public horse(int rent_of_animal) : base(rent_of_animal) { }

public override int price_calculation(int price)

{

Console.WriteLine("calculating the price of horse");

return base.price_calculation(price);

}

class elephent : Animal

{

public elephent(int rent_of_animal) : base(rent_of_animal) { }

public override int price_calculation(int price)

{

Console.WriteLine("calculating the price of elephent");

return base.price_calculation(price);

}

class camel : Animal

{

public camel(int rent_of_animal) : base(rent_of_animal) { }

public override int price_calculation(int price)

{

Console.WriteLine("claculating the price of camel");

return base.price_calculation(price);

}

static void Main(string[] args)

{

Console.WriteLine("please enter the last digit of your vu id  as number of animal you want to buy");

Console.WriteLine("please enter the first 5 digit of your vu id as rent of animal");

int total_price = 0;

for (int i = 0; i <= noOfAnimal; i++)

{

"or if you want to exit press 0");

if (choice == 0)

{

break;

}

if (choice == 1)

{

Animal horse = new horse(rent);

int price = horse.price_calculation(50000);

Console.WriteLine("price for single animla you just bought is:" + price);

total_price += price;

Console.WriteLine("Total price for all the animal's you have bought till now :" + total_price);

}

if (choice == 2)

{

Animal elephent = new elephent(rent);

int price = elephent.price_calculation(80000);

Console.WriteLine("price for single animla you just bought is:" + price);

total_price += price;

Console.WriteLine("Total price for all the animal's you have bought till now" + total_price);

}

if (choice == 3)

{

Animal camel = new camel(rent);

int price = camel.price_calculation(100000);

Console.WriteLine("price for single animla you just bought is:" + price);

total_price += price;

Console.WriteLine("Total price for all the animal's you have bought till now" + total_price);

}

}

}

}

}

}

}

}

OUTPUT Result Screenshot: