Practical C#
Practical C#
(In Class)
OOP PRACTICAL 2
QUESTION 1
Create a windows form application to create, write data inputted in a textbox and read from a
text file called subjects.txt. When the read button is clicked the text will be displayed in a
listbox as show below (Use StreamWriter and Stream Reader classes. 10 marks
label
Enter Text
Textbox
buttons Create
Write
listbox
Read
QUESTION 2
a) Write a program that creates and load an array of 10 integer’s numbers and display
the elements. The program will prompt the user to enter a specific integer to delete
from the array, display the remaining elements. 10
marks
b) Create an abstract class called "Shape" that has methods for calculating the area and
perimeter. Create concrete classes called "Rectangle", "square", and "Circle" that
extend the shape class and implement the area and perimeter methods. (10 marks)
c)
QUESTION 3
- X
SAVE
FONT EXIT
Button
Design a windows forms application to implement the following common Dialog Boxes
.Uses the above interface.
i. OpenfileDialog
ii. saveDialog
iii. printDialog
iv. fontDialog 10 marks
DUE DATE 31 MARCH 2025
(In Class)
QUESTION 4
Create a table Product in MySql .Your table should have the following details
Product Number, name, unit Price.
Create a C# application and connect it to your database. Your application should have the
following buttons. Save, Exit .Add functionality to your buttons. 10 marks
QUESTION 5
a) Write a console program that adds and divides two integers entered by the user from
the keyboard using exception handling (division by zero is mathematically not
allowed) 10 marks
b) Use the sample interface below, write a program with a listbox contain names of
students .Add five students to the listbox at design time .The program should enable
the user to add more students at runtime via a textbox clear all students from the
listbox ,count the number of students in the listbox and display the result in a
messagebox as well as delete a selected student form the listbox 10 marks
List box
Textbox
Student Name
Add Student
John
Tindo
Delete Student Chipo
Munya
Melody
Count Items
Clear list