You are on page 1of 17

Homework 3

CAP 407

MODERN PROGRAMMING TOOLS & TECHNIQUES III

SUBMITTED TO-

Sarabjeet Sir

SUBMITTED BY-

SACHIN RAJ

B34

D3901

con_doctor. b.WriteLine("Enter The Marks Of First Subject") a = Console. per As Integer Public Sub input() Console.net create a namespace withmethods to read details of student like patient_name. total days. costperday. a + b + c) End Sub Public Function calc() per = (a + b + c) / 3 If per >= 90 Then Console.ReadLine() Console.ReadLine() Console.functions to calculate the bill display the same? Ans- Namespace hello Public Class a Public name As String Public regno As Integer Public a. Using console application in vb.WriteLine("Enter The Marks Of Second Subject") b = Console.ReadLine() Console.WriteLine("Name:") name = Console.WriteLine("Total Marks Is::{0}".WriteLine("Registration No:") regno = Console.ReadLine() Console. procedures .WriteLine("GRADE B") . registration_no.WriteLine("Enter The Marks Of Third Subject") c = Console. c.WriteLine("GRADE A") ElseIf per >= 70 And per <= 90 Then Console.ReadLine() Console.Q1. Use member variables.

WriteLine("Student Name is:{0}". name) Console. c) Console.WriteLine("Registration No is:{0}".a() Dim c As Double obj.disp() c = obj. regno) End Sub End Class End Namespace Module Module1 Sub Main() Dim obj As New hello.WriteLine("NOT QUALIFIED") End If Return per End Function Public Sub disp() Console. Else Console.calc() Console.WriteLine("Student Percentage is::{0}".input() obj.ReadKey() End Sub End Module .

OUTPUT .

ByVal e As System.Show("Item Inserted") TextBox1.Push(TextBox1.Text) MessageBox.EventArgs) Handles Label1.Click End Sub Private Sub Button1_Click(ByVal sender As System. ByVal e As System. Create a widow based application to implement LIFO and FIFO concepts in vb.Stack Public Class Form1 Dim stk As New Stack() Private Sub Label1_Click(ByVal sender As System.EventArgs) Handles Button1.Collections.Object.Object.net? Ans- Imports System.Focus() .Q2.Text = "" TextBox1.Click stk.

Click TextBox2.Show("Found") Else MessageBox. ByVal e As System.Click MessageBox.EventArgs) Handles Button2.Contains(a) Then MessageBox.Object.Show("Not Found") End If End Sub End Class .WriteLine("Top Element Deleted") TextBox1.Text = "" TextBox1.Pop() Console.Object.Peek()) End Sub Private Sub Button4_Click(ByVal sender As System. ByVal e As System. End Sub Private Sub Button2_Click(ByVal sender As System.EventArgs) Handles Button3. ByVal e As System.Click Dim a As Object a = InputBox("Enter the Item To Find in Stack") If stk.Focus() End Sub Private Sub Button3_Click(ByVal sender As System.Object.Show("First Element Is=" & stk.EventArgs) Handles Button4.Text = stk.

Object.Queue Public Class Form1 Dim que As New Queue() Private Sub Label1_Click(ByVal sender As System.Show("Item Inserted") TextBox1.Clear() MessageBox.Show("All Element Cleared") End If . ByVal e As System.Enqueue(TextBox1.EventArgs) Handles Button1.Text) MessageBox. ByVal e As System.Collections.EventArgs) Handles Button2. ByVal e As System.EventArgs) Handles Label1.Queue In Windows Form Imports System.Object.Click End Sub Private Sub Button1_Click(ByVal sender As System.Object.Dequeue) ElseIf a = "clear" Then que.Click que.Show("Top Element Deleted::" & que.Text = "" End Sub Private Sub Button2_Click(ByVal sender As System.Click Dim a As Object a = InputBox("Which Operation Do u Like To perform--POP OR CLEAR") If a = "pop" Then MessageBox.

Contains(a) Then MessageBox.EventArgs) Handles Button3.Object.Peek()) End Sub End Class .Click MessageBox.Object. End Sub Private Sub Button3_Click(ByVal sender As System. ByVal e As System.Show("Found") Else MessageBox. ByVal e As System.Click Dim a As Object a = InputBox("Enter elements which U want To Search") If que.Show("Not Found") End If End Sub Private Sub Button4_Click(ByVal sender As System.Show("First Element is" & que.EventArgs) Handles Button4.

date/time picker. Make use of procedures and functions where ever possible? . combobox . Make use of controls like textbox. listbox.Q3. Create a windows application that calculates salary of an emplyee.

.

IO Imports System.*" If fo.Forms.Filter = "text.net to implement functionality of file menu? Ans- Imports System.Object. ByVal e As System. ByVal e As System. Using a rich text box create an application in vb.EventArgs) Handles SaveToolStripMenuItem.files(*.Click Dim sr As StreamReader Dim fo As New OpenFileDialog() fo.OpenFile) RichTextBox1.OK Then sr = New StreamReader(fo.Form Public Class Form1 Private Sub OpeToolStripMenuItem_Click(ByVal sender As System.ShowDialog() = DialogResult.ReadToEnd() sr.EventArgs) Handles OpeToolStripMenuItem.Close() End If End Sub Private Sub SaveToolStripMenuItem_Click(ByVal sender As System.Click Dim sw As StreamWriter Dim filename As String .txt| " & " all files| *.txt) |*.Object.Text = sr.PART.Windows.B Q4.

Dim fs As New SaveFileDialog() fs.Write(RichTextBox1.txt| " & " all files| *.OK Then filename = fs.files(*.Filter = "text.FileName sw = New StreamWriter(filename) sw.*" If fs.EventArgs) Handles SaveAsToolStripMenuItem.Object.ShowDialog() = DialogResult.FileName = filename fs.Click End End Sub End Class .Text) sw. ByVal e As System.Close() End If End Sub Private Sub SaveAsToolStripMenuItem_Click(ByVal sender As System.txt) |*.

.

EventArgs) Handles FontToolStripMenuItem.Object. ByVal e As System.Font End If End Sub Private Sub ColorToolStripMenuItem_Click(ByVal sender As System.OK Then RichTextBox1.Color = RichTextBox1.Color = RichTextBox1.Object.Font fd.Q5.Click Dim raj As New ColorDialog() raj. ByVal e As System.Click Dim fd As New FontDialog() fd.ShowDialog = DialogResult. colour and use of system calculator in an application? Ans- Public Class Form1 Private Sub FontToolStripMenuItem_Click(ByVal sender As System.net using rich text box to implement font.ForeColor If fd.Font = RichTextBox1.Font = fd.ForeColor If raj.ShowDialog() = DialogResult.ForeColor = raj.OK Then RichTextBox1. Create an application in vb.EventArgs) Handles ColorToolStripMenuItem.Color End If .

End Sub End Class .

Click sachin += 1 MessageBox. ByVal e As System.Click End End Sub End Class . Create a window based application in VB.Object. Display a message box whenever the button is being clicked and count the number of clicks user have done.Net with a button.EventArgs) Handles Button1. Place a exit button to close the application and display the number times user have clicked the button? Ans- Public Class Form1 Dim sachin As Integer = 0 Private Sub Button1_Click(ByVal sender As System.Object.") End Sub Private Sub Button2_Click(ByVal sender As System.Show("You Have Clicked->" & sachin.Q6.ToString() & " Times.EventArgs) Handles Button2. ByVal e As System.