CS411 Assignment 2 Solution Fall 2021

CS411 Assignment 2 Solution 2021

CS411 Assignment 2 Solution Fall 2021

 Total marks = 20      Due Date = 21st December 2021


Please carefully read the following instructions before attempting assignment.


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

  • The assignment is submit 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 7 to 14


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 to calculate area of rectangle with the following functional requirements:

Create an interface and name it “Shape”. And it will contain declaration of two methods.

  • getInput 2)  area

Create a single class


Rectangle class will have a function getInput() to take input values from user and area() to calculate the area of respective category.

Your Program should have the following functionalities:

First you have to take your VUID as a input.

In the Rectangle class create a function getInput() in which you will take an input from the user for the attribute length and width. You have to take first digit of your VUID as length of rectangle and last two digit of VUID as a width. For example, if your ID is BS123456789 so your length value should be 1 and width value should be 89. Now create a function area() to calculate the area of rectangle. . (Note: You should also have to check if the first and last two numeric character of your vu id is zero then your code should increment it with 1 so in any case your code should not return zero answer. This check is compulsory for every student, whether your vuid has 0 as the starting or ending digit or not)

  • After taking all values from user when you press enter a window form will appear as shown in below figure.
  • When you click on calculate button, a built-in delegate function should invoke and a dialog box that will display Area of rectangle appear on screen. Remember that you don’t need to create custom delegate for this purpose, just use built-in delegate code in your application.


CS411 Assignment 2 Solution 2021      


Submission details

Following Files Must be submit in a single zip or rar file.

·         .cs code file (file name should be your VUID)

·         screenshot of your final output as shown in above figure.( rectangle area dialog box, Window form and Console screen with all input values.

You are not required to submit the complete project, only copy required file from project folder.