# CS411 Assignment 1 Solution Fall 2021 - Free Download

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

Provide by VU Answer

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");

int noOfAnimal = int.Parse(Console.ReadLine());

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

int rent = int.Parse(Console.ReadLine());

int total_price = 0;

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

{

Console.WriteLine("if you want to buy horse, please press 1 \n" +

"if you want to buy elephent, please press 2 \n" +

"if you want to buy camel, please press 3 \n" +

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

int choice = int.Parse(Console.ReadLine());

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:

Download CS411 Assignment 1 Solution Fall 2021 ZIP File

Download CS411 Assignment 1 Solution Fall 2021 Word File

Download CS411 Assignment 1 Solution Fall 2021 PDF File

Don't copy-paste the same answer.

Make sure you can make some changes to your solution.

If you found any mistake then correct yourself and inform me.

Before submitting an assignment check your assignment requirement file.

If you need some help and question about file and solutions comment below.