Visual Programming Paper
Visual Programming Paper
Write base class with the name Shape . The Shape class have Private Variable: area, a double used to hold
the shape's area.
Public Member Functions: getArea the Accessor. This function should return the value in the member
variable area.
Parameterized constructor—Initializes area member.
Defualt constructor— Empty body
calcArea. This function should be a incomplete function.
Next, define a class named Triangle . It should be child of Shape class. It should have the following
members:
Protected Member Variables: base, a integer used to hold the base of triangle.
Height, a integer used to hold the height of the triangle.
Public Member Functions: constructor—Initializes values for base, height.
The overridden calcArea function in Circle described below.
calcArea—calculates the area of the Triangle (1/2* base * height) and stores the result in the inherited
member area.
After you have created these classes, create a driver program that defines a Triangle object.
Demonstrate that each object properly calculates and reports its area. Use Proper Exception
handling in this program.What type of inheritance is used in this given scenario(Single , Multiple or
Multilevel). Is calcArea must be overrided ? (6 Marks)
Q2) Bind Student Table having field RollNo , Name , Marks to ComboBox. Then Display name of
Student with highest marks only. (6 Marks)
Q3) Create a class with name savingaccont.In this class you have to write the static method having
name CalculteFutureValue which takes three parameters of type double along with return type
double.This function should implement the formula given below.
F = P * (1 + i)t
The terms in the formula are as follows:
• F is the future value of the account after the specified time period.
• P is the present value of the account.
• i is the monthly interest rate .
• t is the number of months .
Write Driver class which contains main function that prompts the user to enter the account’s present
value, monthly interest rate, and the number of months that the money will be left in the account. The
program should pass these values to a function named CalculteFutureValue that returns the
future value of the account, after the specified number of months. The program should
display the account’s future value. (6 Marks)
1 of 3
Q4) Create a class name Exponents and Write a function power(base , exponent) that takes 2
parameters of type ” int” that returns the value of base exponent. Base is nonzero positive integer while
exponent is positive integer.
Call this power method within function button_click of windows form class that reads integer values
for base and exponent from user and performs the calculation written in the power method of
Exponents class. If returned value is even it should display on label otherwise display it on textbox.
Built-in functions are not allowed to use.(Assume label name lblDisplay and textbox name txtDisplay)
(6 Marks)
Q5) Write static function in C# that displays the following pattern and call it in main function which
is in another class (6 Marks)
1 2 3 4 5
2 3 4 5 6
3 4 5 6 7
Q.6 Write the Ado.Net code for the following scenario
a) Build Windows forms for that database tables(Separate Parent and Child forms)
b) Do the insert data into database functionality through forms(Insert into both tables).
c) Display record of Customers having name start with J in the datagridview.
d) Explain functionality of building function use in the code.
2 of 3
3 of 3