Latest Activity In Study Groups

Join Your Study Groups

VU Past Papers, MCQs and More

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

Visual Programming (CS411)

Assignment # 01

 

Total marks = 20                                                                              

 

Deadline Date:

9th December, 2021

 

 

 

Please carefully read the following instructions before attempting assignment.

RULES FOR MARKING

It should be clear that your assignment would not get any credit if:

  • The assignment is submitted after the due date.
  • The submitted assignment does not open or file is corrupt.
  • Strict action will be taken if submitted solution is copied from any other student or from the internet.

 

Lectures:

 

·         Lectures 1 to 6 are covered in this assignment

 

NOTE

No assignment will be accepted after the due date via email in any case (whether it is the case of load shedding or internet malfunctioning etc.). Hence refrain from uploading assignment in the last hour of deadline. It is recommended to upload solution file at least two days before its closing date.

If you people find any mistake or confusion in assignment (Question statement), please consult with your instructor before the deadline. After the deadline no queries will be entertained in this regard.

For any query, feel free to email at:  cs411@vu.edu.pk

 

                                                                                                                                                         

 

 

 

     (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

Stay touched with this discussion, Solution idea will be uploaded as soon as possible in replies here before the due date.

CS411 Assignment#01 Fall 2021 Solution file 

CS411-Assignment-01-Solution-Fall-2021_VU_Ning.pdf

CS411 One more idea solution solution file 

CS411-Assig%2301-Solution-Fall-2021.pdf

CS411 Assignment 1 Fall 2021 solution idea:

 

Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
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);
}
}
}
}
}
}
}
}

#CS411 #CS411assignment1solution2021 #phy101
CS411 Assignment No.1 Solution Fall 2021 || CS411 Assignment Solution

CS411 Assignment 1 Solution Fall 2021 By FK Tutors
CS411 Assignment No.1 Fall 2021 100% Correct Complete Solution Learning with FK Tutors. CS411 Assignment 1 Complete Correct Solution Solved 2021 || Fall 2021 CS411 Solution Assignment No.1 2021 || Complete Correct Fall 2021 Solved. CS411 Assignment 1 Complete Solution Fall 2021, CS411 Assignment 1 Complete Solution, CS411 Assignment 1, CS411 , CS411 Assignment 1 solution, CS411 assignment Fall 2021, CS411 assignment solution Fall 2021, CS411 assignment, Assignment 1 CS411 solution, solution CS411 Assignment 1, CS411 Assignment 1 solution 2021, CS411 assignment solution 2021, CS411 Assignment 1, CS411 Assignment 1 solution Fall 2021, CS411 Assignment no 1 solution Fall 2021, CS411 Assignment no 1 solution 2021, CS411 2nd assignment solution 2021, CS411 1rd assignment solution, CS411 1rd assignment solution Fall 2021,assignment solution Fall 2021, #CS411 #CS411assignment1solution2021

#CS411 #CS411assignment1solution2021
CS411 Assignment No.1 Fall 2021 100% Correct Complete Solution

CS411 Assignment 1 Solution Fall 2021 By Abid Farooq Bhutta
CS411 Assignment No.1 Fall 2021 100% Correct Complete Solution By Abid Farooq Bhutta. CS411 Assignment 1 Complete Correct Solution Solved 2021 || Fall 2021 CS411 Solution Assignment No.1 2021 || Complete Correct Fall 2021 Solved. CS411 Assignment 1 Complete Solution Fall 2021, CS411 Assignment 1 Complete Solution, CS411 Assignment 1, CS411 , CS411 Assignment 1 solution, CS411 assignment Fall 2021, CS411 assignment solution Fall 2021, CS411 assignment, Assignment 1 CS411 solution, solution CS411 Assignment 1, CS411 Assignment 1 solution 2021, CS411 assignment solution 2021, CS411 Assignment 1, CS411 Assignment 1 solution Fall 2021, CS411 Assignment no 1 solution Fall 2021, CS411 Assignment no 1 solution 2021, CS411 2nd assignment solution 2021, CS411 1rd assignment solution, CS411 1rd assignment solution Fall 2021,assignment solution Fall 2021, #CS411 #CS411assignment1solution2021

CS411 Assignment 1 Solution Fall 2021 | CS411 Assignment 1 Solution By VUBWN | CS411 Assignment

CS411 Assignment 1 Solution fall 2021 | CS411 Assignment No 1 Solution 2021

CS411 Assignment 1 Solution 2021, CS411 Assignment No 1 Solution Fall 2021, CS411, CS411 Assignment 1, CS411 Assignment 1 Solution 2021, CS411 Assignment 1 Fall2021, CS411 Assignment Solution, CS411 Assignment No 1, CS411 Assignment 1 Solution2021, CS411 Solution, CS411 Assignment 1 Solution 2021, CS411 Solution Link, CS411 Assignment 1 Solution2021, CS411 DownloadLink, CS411AssignmentPDF, CS411Assignment CS411Assignment1Solution2021 CS411AssignmentSolutionCPP CS411Assignment CS411Assignment1Solution2021 CS411AssignmentDownload CS411Solve CS411Assignment1Solution2021 CS411Assignment1 CS411Assignment1Solution2021 CS411 Assignment 1 Solution 2021 CS411 Assignment 1 Solution 2021 CS411 Assignment 1 Solution 2021 CS411 Assignment 1 Solution 2021 CS411 Assignment 1 Solution 2021 CS411 Assignment 1 Solution 2021 CS411 Assignment 1 Solution 2021 CS411 Assignment 1 Solution 2021 CS411 assignment 1 solution 2021, CS411 assignment no 1 solution Fall 2021, CS411, CS411 assignment 1, CS411 assignment 1 solution 2021, CS411 assignment 1 Fall2021, CS411 assignment solution, CS411 assignment no 1, CS411 assignment 1 solution2021, CS411 solution, CS411 assignment 1 solution 2021, CS411 solution link, CS411 assignment 1 solution2021, CS411 downloadlink, CS411assignmentpdf,

#CS411 #CS411assignment1solution2021 #phy101
CS411 Assignment No.1 Solution Fall 2021 || CS411 Assignment Solution

RSS

© 2022   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service