You are on page 1of 41

Ex no 1 06-06-2012 AIM:

SUM OF TWO NUMBERS

To create a windows application for find the sum of two numbers. FORM DESIGN:

CODING: using using using using using using using System; System.Collections.Generic; System.ComponentModel; System.Data; System.Drawing; System.Text; System.Windows.Forms;

namespace Sum_of_2_numbers { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { int a, b, ans; a = int.Parse(textBox1.Text); b = int.Parse(textBox2.Text); ans = a + b; textBox3.Text = ans.ToString();

} } }

OUTPUT:

Result is:

Ex no 2 08-06-2012 AIM:

CONCATINATION OF TWO STRINGS

To create a windows application for find the concatination of two string s. FORM DESIGN:

CODING: using using using using using using using System; System.Collections.Generic; System.ComponentModel; System.Data; System.Drawing; System.Text; System.Windows.Forms;

namespace Sum_of_2_numbers { public partial class CONCATINATION_OF_TWO_STRINGS : Form { public CONCATINATION_OF_TWO_STRINGS() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { String s1, s2, s3; s1 = textBox1.Text; s2 = textBox2.Text; s3 = s1 + s2; textBox3.Text = s3; } } }

OUTPUT: After entering strings,

After pressing Concatenation button

Ex no 3 TEXT BOX FORECOLOR CHANGING USING BUTTONS 08-06-2012 AIM: To create a windows application for changing the text box fore color us ing ratio buttons. FORM DESIGN

CODING: using using using using using using using System; System.Collections.Generic; System.ComponentModel; System.Data; System.Drawing; System.Text; System.Windows.Forms;

namespace Textbox_Forecolor { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { if (radioButton1.Checked == true) { textBox1.Text = "RED IS SELECTED"; textBox1.ForeColor = Color.Red; } if (radioButton2.Checked == true) { textBox1.Text = "BLUE IS SELECTED"; textBox1.ForeColor = Color.Blue; } if (radioButton3.Checked == true) { textBox1.Text = "GREEN IS SELECTED"; textBox1.ForeColor = Color.Green; } } private void button2_Click(object sender, EventArgs e) { radioButton1.Checked = false; radioButton2.Checked = false; radioButton3.Checked = false; } }

OUPUT: After selecting

After clicking

Ex no 4 13-06-2012 AIM:

GREATEST OF TWO NUMBERS

To create a windows application for find the greatest number among two n umbers. FORM DESIGN:

CODING: using using using using using using using System; System.Collections.Generic; System.ComponentModel; System.Data; System.Drawing; System.Text; System.Windows.Forms;

namespace Greatest_of_3 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { int a, b; a = int.Parse(textBox1.Text); b = int.Parse(textBox2.Text); if (a > b) MessageBox.Show("Greatest Number is A"); else MessageBox.Show("Greatest Number is B"); } } }

OUTPUT: After giving 2 numbers

Result is

Ex no 5 15-06-2012 AIM:

CALCULATOR

To create a windows application for calculator. FORM DESIGN:

CODING: using using using using using using using System; System.Collections.Generic; System.ComponentModel; System.Data; System.Drawing; System.Text; System.Windows.Forms;

namespace Calculator { public partial class Form1 : Form { public Form1() { InitializeComponent(); Application.Run(new Form2()); } Double total1; Double total2; bool plusButtonClicked = false; bool minusButtonClicked = false; bool multiplyButtonClicked = false; bool divisionButtonClicked = false; private void button1_Click(object sender, EventArgs e) { textBox1.Text = textBox1.Text + button1.Text; } private void button2_Click(object sender, EventArgs e) { textBox1.Text = textBox1.Text + button2.Text; } private void button3_Click(object sender, EventArgs e) { textBox1.Text = textBox1.Text + button3.Text; } private void button4_Click(object sender, EventArgs e) { textBox1.Text = textBox1.Text + button4.Text; } private void button5_Click(object sender, EventArgs e) { textBox1.Text = textBox1.Text + button5.Text; } private void button6_Click(object sender, EventArgs e) { textBox1.Text = textBox1.Text + button6.Text; } private void button7_Click(object sender, EventArgs e)

{ textBox1.Text = textBox1.Text + button7.Text; } private void button8_Click(object sender, EventArgs e) { textBox1.Text = textBox1.Text + button8.Text; } private void button9_Click(object sender, EventArgs e) { textBox1.Text = textBox1.Text + button9.Text; } private void button10_Click(object sender, EventArgs e) { textBox1.Text = textBox1.Text + button10.Text; } private void button13_Click(object sender, EventArgs e) { total1 = total1 + Double.Parse(textBox1.Text); textBox1.Clear(); plusButtonClicked = true; minusButtonClicked = false; multiplyButtonClicked = false; divisionButtonClicked = false; } private void button14_Click(object sender, EventArgs e) { total1 = total1 + Double.Parse(textBox1.Text); textBox1.Clear(); plusButtonClicked = false; minusButtonClicked = true; multiplyButtonClicked = false; divisionButtonClicked = false; } private void button15_Click(object sender, EventArgs e) { total1 = total1 + Double.Parse(textBox1.Text); textBox1.Clear(); plusButtonClicked = false; minusButtonClicked = false; multiplyButtonClicked = true; divisionButtonClicked = false; } private void button16_Click(object sender, EventArgs e) { total1 = total1 + Double.Parse(textBox1.Text); textBox1.Clear(); plusButtonClicked = false; minusButtonClicked = false; multiplyButtonClicked = false; divisionButtonClicked = true; } private void button11_Click(object sender, EventArgs e)

{ if (plusButtonClicked == true) total2 = total1 + Double.Parse(textBox1.Text); else if (minusButtonClicked == true) total2 = total1 - Double.Parse(textBox1.Text); else if (multiplyButtonClicked == true) total2 = total1 * Double.Parse(textBox1.Text); else if (divisionButtonClicked == true) total2 = total1 / Double.Parse(textBox1.Text); textBox1.Text = total2.ToString(); total1 = 0; } private void button12_Click(object sender, EventArgs e) { textBox1.Clear(); } private void button17_Click(object sender, EventArgs e) { textBox1.Text = textBox1.Text + button17.Text; } } }

OUTPUT:

First Number input:

Second number input:

Result:

Ex no 6 15-06-2012 AIM:

ELECTRICITY BILL GENERATION

To create a windows application for Generate electricity bill.

FORM DESIGN:

CODING: using using using using using using using System; System.Collections.Generic; System.ComponentModel; System.Data; System.Drawing; System.Text; System.Windows.Forms;

namespace Calculator { public partial class Form2 : Form { public Form2() { InitializeComponent(); Application.Run(new Form3()); } private void button1_Click(object sender, EventArgs e) { int unit; int u1=99, u2=0, u3=0, u4=0; unit = int.Parse(textBox3.Text); if (unit < 99) u1 = unit; else if ((unit >= 100) && (unit < 199)) u2=unit-u1; else if ((unit >= 200) && (unit < 499)) { u2 = 100;

u3 = unit - u1 - u2; } else if (unit >= 500) { u2 = 100; u3 = 300; u4 = unit - u1 - u2 - u3; } unit = (u1 * 2) + (u2 * 3) + (u3 * 4) + (u4 * 5); textBox4.Text = unit.ToString(); } private void button2_Click(object sender, EventArgs e) { textBox1.Clear(); textBox2.Clear(); textBox3.Clear(); textBox4.Clear(); } } }

OUTPUT:

Ex no 7 22-06-2012 AIM:

STUDENT MARKLIST

To create a windows application for Display the student mark list.

FORM DESIGN :

CODING: using using using using using using using System; System.Collections.Generic; System.ComponentModel; System.Data; System.Drawing; System.Text; System.Windows.Forms;

namespace Calculator { public partial class Form3 : Form { public Form3() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { String name,result; int reg,m1,m2,m3,m4,m5; int total; Double avg; name=textBox1.Text; reg=int.Parse(textBox2.Text); m1 = int.Parse(textBox3.Text); m2 = int.Parse(textBox4.Text); m3 = int.Parse(textBox5.Text); m4 = int.Parse(textBox6.Text); m5 = int.Parse(textBox7.Text); total = m1 + m2 + m3 + m4 + m5; avg = (total / 5); label8.Visible = true; label9.Visible = true; label10.Visible = true; label11.Visible = true; textBox8.Visible = true; textBox9.Visible = true; textBox10.Visible = true; textBox11.Visible = true; if ((m1 >= 40) && (m2 >= 40) && (m3 >= 40) && (m4 >= 40) && (m5 >= 5 0))

result = "PASS"; else result = "FAIL"; if (result == "PASS") { if (avg >= 90) textBox11.Text = else if (avg >= 80) textBox11.Text = else if (avg >= 70) textBox11.Text = else if (avg >= 60) textBox11.Text = else if (avg >= 50) textBox11.Text = }

"S"; "A"; "B"; "C"; "D";

textBox8.Text=total.ToString(); textBox9.Text=avg.ToString(); textBox10.Text=result; } private void button2_Click(object sender, EventArgs e) { textBox1.Clear(); textBox2.Clear(); textBox3.Clear(); textBox4.Clear(); textBox5.Clear(); textBox6.Clear(); textBox7.Clear(); label8.Visible = false; label9.Visible = false; label10.Visible = false; label11.Visible = false; textBox8.Visible = false; textBox9.Visible = false; textBox10.Visible = false; textBox11.Visible = false; } } }

OUTPUT:

Ex No : 08 27-06-2012 AIM :

SWAP OF TWO NUMBERS

To write a console application for swap 2 numbers by value and reference . CODING: using System; using System.Collections.Generic; using System.Text; namespace Swap_value { class Program { static void Main(string[] args) { int a = 100, b = 200; Program p = new Program(); Console.WriteLine("In main...."); Console.WriteLine("\na={0} , b={1} ", a, b); p.swap(a, b); Console.WriteLine("\nIn main...."); Console.WriteLine("\na={0} , b={1} ", a, b); p.swap(ref a, ref b); Console.WriteLine("In main...."); Console.WriteLine("\na={0} , b={1} ", a, b); Console.ReadKey(); } public void swap(int x, int y) { int t = 0; t = x; x = y;

y = t; Console.Write("\nBy Value...."); Console.WriteLine("\n a={0}, b={1} ", x, y); } public void swap(ref int x, ref int y) { int t = 0; t = x; x = y; y = t; Console.Write("\nBy Reference...."); Console.WriteLine("\n a={0}, b={1} ", x, y); } } }

OUTPUT:

Ex No : 9 27-06-2012 AIM:

IMPLEMENTATION OF ARRAY

To write a console application for implement the array concepts. CODING: using System; using System.Collections.Generic; using System.Text; namespace Implementation_of_Array { class Program { static void Main(string[] args) { int[] a = new int[5]; int i, t; String s; Console.Write("Enter 5 Elements : \n"); for (i = 0; i < a.Length; i++) { s = Console.ReadLine(); t = int.Parse(s); a.SetValue(t, i); } Console.Write("Array Elements are... \n"); for (i = 0; i < a.Length; i++) Console.WriteLine("{0}", a.GetValue(i)); Console.Write("\nARRAY IMPLEMENTATION"); Console.WriteLine("\n\nUsing SetValue...."); a.SetValue(3, 1); Console.WriteLine("1st Element is : {0} ", a.GetValue(1)); Console.Write("\nLength of Array is :"); Console.WriteLine("{0}", a.Length); Array.Reverse(a); Console.Write("\nReverse Array is...\n"); for (i = 0; i < a.Length; i++) Console.WriteLine("{0}",a.GetValue(i)); Array.Sort(a); Console.Write("\nSorted Array is...\n"); for (i = 0; i < a.Length; i++) Console.WriteLine("{0}", a.GetValue(i)); Console.ReadKey(); } } }

OUTPUT:

Ex No : 10 27-06-2012 AIM:

MATRIX MULTIPLICATION

To write a console application to perform matrix multiplication. CODING: using System; using System.Collections.Generic; using System.Text; namespace Matrix_Multipplication { class Program

{ static void Main(string[] args) { int[,] a = new int[10, 10]; int[,] b = new int[10, 10]; int[,] c = new int[10, 10]; String s; int i, j, n, t; Console.Write("Enter the Size of the Array : "); s = Console.ReadLine(); n = int.Parse(s); Console.Write("\nEnter First Array Elements : "); for(i=0;i<n;i++) for(j=0;j<n;j++) { Console.WriteLine("\nEnter a[{0},{1}] Element : ",i,j); s=Console.ReadLine(); t = int.Parse(s); a.SetValue(t, i, j); } Console.Write("\nEnter Second Array Elements : "); for (i = 0; i < n; i++) for (j = 0; j < n; j++) { Console.WriteLine("\nEnter b[{0},{1}] Element : ", i, j); s = Console.ReadLine(); t = int.Parse(s); b.SetValue(t, i, j); c[i, j] = a[i, j] * b[i, j]; } Console.Write("\nMatrix Multiplication is....."); for (i = 0; i < n; i++) { Console.Write("\n"); //Console.WriteLine("\n{0} Row is...\n", i + 1); for (j = 0; j < n; j++) Console.Write("{0} ", c[i, j]); Console.WriteLine("\n"); } Console.ReadKey(); } } } OUTPUT:

Ex No : 11 29-06-2012 AIM:

STUDENT MARKLIST USING STRUCTURES

To write a console application for display the student marklist using st ructures. CODING: using System; using System.Collections.Generic; using System.Text; namespace Student_Marklist { class Program { struct Student { String Name, Grade, t; int Roll_Number, m1, m2, m3, m4, m5, Total; float Average; public void Input() { Console.Write("Enter Your Name : "); Name = Console.ReadLine(); Console.Write("Enter Your Roll Number : "); t = Console.ReadLine(); Roll_Number = int.Parse(t); Console.Write("Enter Your Mark 1 : "); t = Console.ReadLine(); m1 = int.Parse(t); Console.Write("Enter Your Mark 2 : "); t = Console.ReadLine(); m2 = int.Parse(t);

Console.Write("Enter Your Mark 3 : "); t = Console.ReadLine(); m3 = int.Parse(t); Console.Write("Enter Your Mark 4 : "); t = Console.ReadLine(); m4 = int.Parse(t); Console.Write("Enter Your Mark 5 : "); t = Console.ReadLine(); m5 = int.Parse(t); } public void Calculate() { Total = m1 + m2 + m3 + m4 + m5; Average = (Total / 5); if (Average >= 90) Grade = "S"; else if (Average >= 80) Grade = "A"; else if (Average >= 70) Grade = "B"; else if (Average >= 60) Grade = "C"; else if (Average >= 50) Grade = "D"; } public void Display() { Console.Write("\n\n\t STUDENT MARKLIST"); Console.Write("\n\n Name : {0}", Name); Console.Write("\n Total : {0}", Total); Console.Write("\n Average : {0}", Average); Console.Write("\n Grade : {0}", Grade); } }; static void Main(string[] args) { Student s1 = new Student(); s1.Input(); s1.Calculate(); s1.Display(); Console.ReadKey(); } } }

OUTPUT:

Ex No : 12 04-07-2012 AIM:

SEARCHING AN ELEMENT IN THE ARRAY

To write a console application for searching an element in the array. CODING: using System; using System.Collections.Generic; using System.Text; namespace Search_an_Element { class Program { static void Main(string[] args) { int[] a = new int[100]; String str; int i, n, t,s; Console.Write("Enter the Size of the Array : "); str = Console.ReadLine(); n = int.Parse(str); Console.Write("\nEnter Array Elements : "); for (i = 0; i < n; i++) { str = Console.ReadLine(); t = int.Parse(str); a.SetValue(t, i); } Console.Write("Enter The Number to be Searched : "); str = Console.ReadLine(); s = int.Parse(str); for (i = 0; i < n; i++) if (a[i] == s) Console.WriteLine("\nNumber Is FOUND at {0}th Position", i); Console.ReadKey(); } } }

OUTPUT:

Ex No : 13 04-07-2012 AIM:

GREATEST OF THREE NUMBERS

To write a console application for find the greatest number among three numbers. CODING: using System; using System.Collections.Generic;

using System.Text; namespace Greatest_of_3_Numbers { class Program { static void Main(string[] args) { int a, b, c; String str; Console.Write("\nEnter Value for a : "); str = Console.ReadLine(); a = int.Parse(str); Console.Write("\nEnter Value for b : "); str = Console.ReadLine(); b = int.Parse(str); Console.Write("\nEnter Value for c : "); str = Console.ReadLine(); c = int.Parse(str); if ((a > b) && (a > c)) Console.Write("\nGreatest Number else if ((b > a) && (b > c)) Console.Write("\nGreatest Number else if ((c > a) && (c > b)) Console.Write("\nGreatest Number else Console.Write("\nTwo Numbers are Console.ReadKey(); } } } is A = {0}", a); is B = {0}", b); is C = {0}", c); Equal");

OUTPUT:

Ex No : 14 04-07-2012 AIM:

PASCAL TRIANGLE

To write a console application for print the Pascal triangle. CODING: using System; using System.Collections.Generic; using System.Text; namespace Pascal_triangle { class Program { static void Main(string[] args) { Program P =new Program(); int i, n, c; int t1,t2,t3; String s; Console.Write("Enter Total rows : "); s = Console.ReadLine(); n = int.Parse(s); for (i = 0; i < n; i++) { for (c = 0; c <= n-i-2; c++)

Console.Write(" "); for (c = 0; c <= i; c++) { t1 = P.factorial(i); t2 = P.factorial(c); t3 = P.factorial(i - c); Console.Write(" {0} ", t1 / (t2 * t3)); } Console.Write("\n"); } Console.ReadKey(); } public int factorial(int a) { int i, result=1; for (i = 1; i <= a; i++) result = result * i; return result; } } }

OUTPUT:

Ex No : 15 06-07-2012 AIM:

EMPLOYEE PAY COLLECTION

To write a console application for finding the total salary (NET) for N employees. CODING: using System; using System.Collections.Generic; using System.Text; namespace Employee_Pay_Collection { class Program { struct employee { String Name, s, position; int id, Basic, Net, allow, detections, pf, hra, loan, ta; public void input() { Console.Write("\nEnter Your Name : "); Name = Console.ReadLine(); Console.Write("Enter Your Employee ID : "); s = Console.ReadLine(); id = int.Parse(s); Console.Write("Enter Your Basic Pay : "); s = Console.ReadLine(); Basic = int.Parse(s); Console.Write("Enter Your PF : "); s = Console.ReadLine(); pf = int.Parse(s); Console.Write("Enter Your Loan : "); s = Console.ReadLine(); loan = int.Parse(s); Console.Write("Enter Your HRA : "); s = Console.ReadLine(); hra = int.Parse(s); Console.Write("Enter Your TA : "); s = Console.ReadLine(); ta = int.Parse(s);

} public void calculate() { allow=Basic+hra+ta; detections=pf+loan; Net=allow-detections; if (Net >= 60000) position = "MANAGER"; else if (Net >= 50000) position = "SUPER VISER"; else position = "EMPLOYEE"; } public void display() { Console.Write("\n{0}\t{1}\t{2}\t{3}\t\"{4}\"", Name,id,Basic,Net ,position); } }; static void Main(string[] args) { int i,n; string s; employee []e = new employee[10]; Console.Write("Enter Total Employees : "); s=Console.ReadLine(); n=int.Parse(s); for (i = 0; i < n; i++) { e[i].input(); e[i].calculate(); } Console.Write("\n\tPAYBILL GENERATION"); Console.Write("\n\n NAME \tID \tBASIC \tNET \tDESGINATION"); for (i = 0; i < n; i++) e[i].display(); Console.ReadKey(); } } }

OUTPUT:

Ex No : 16 11-07-2012 AIM:

MULTIPLICATION TABLE

To write a console application for print the multiple table for three, f our and seven. CODING: using System; using System.Collections.Generic; using System.Text; namespace Multiplication_table { class Program { static void Main(string[] args) { int[] three = new int[] { 3, 6, 9, 12, 15, 18, 21, 24, 27, 30 }; int[] four = new int[] { 4, 6, 12, 16, 20, 24, 28, 32, 36, 40 }; int[] seven = new int[] { 7, 14, 21, 28, 35, 42, 49, 56, 63, 70 }; int i = 0; Console.Write("Multiple Tables....."); Console.Write("\n\nTHREE\n"); foreach(Object k in three) { Console.Write("\n{0} * 3 = {1}",i+1,k); i++; } i = 0; Console.Write("\n\nFOUR\n"); foreach (Object k in four) { Console.Write("\n{0} * 4 = {1}", i + 1, k); i++; } i = 0; Console.Write("\n\nSEVEN\n"); foreach (Object k in seven) { Console.Write("\n{0} * 7 = {1}", i + 1, k); i++; } Console.ReadKey(); } } }

OUTPUT:

Ex No : 17 11-07-2012 AIM:

PATTERN OF WORD MATCHING

To write a console application for calculate the total tence. CODING: using System; using System.Collections.Generic; using System.Text; namespace Word_Matching { class Program { static void Main(string[] args) { String s; String[] and ={"and","And","AND"}; String[] from = {"from","From","FROM"}; int Count1=0,Count2=0; Console.Write("Enter a String : "); s = Console.ReadLine();

and

and

from

in th

String[] given = s.Split(); foreach (String i in given) { foreach (String j in and) if (i == j) Count1+=1; foreach (String j in from) if (i == j) Count2+=1; } Console.WriteLine("\nAnd = {0}\nFrom = {1}", Count1, Count2); Console.ReadKey(); } } }

OUTPUT:

Ex No : 18 11-07-2012 AIM:

SALES IN STATIONARY SHOP

To write a console application for calculate the bill amount in a statio nary shop. CODING: using System; using System.Collections.Generic; using System.Text; namespace Stationary_Shop { class Program { static void Main(string[] args) { stationary s=new stationary(10,5,10,50,0); s.Input(); s.Calculate(); s.Display(); Console.ReadKey(); } } class stationary { String[] items=new String[4]{"Pen","Pencil","Paper","Note"}; int[] prize=new int[4]; int[] Qty=new int[4]; int[] total=new int[4]; int Total=0; public stationary(int a,int b,int c,int d,int e) { prize[0]=a; prize[1]=b; prize[2]=c; prize[3]=d; for (int i = 0; i < 4;i++ ) Qty[i] = e;

} public void Input() { string s; Console.Write("\nEnter the Following Quantity....\n "); Console.Write("\nPen,Pencil,Paper,Note : "); for(int i=0;i<4;i++) { s=Console.ReadLine(); Qty[i]=int.Parse(s); } } public void Calculate() { for(int i=0;i<4;i++) { total[i]=Qty[i]*prize[i]; Total+=total[i]; } } public void Display() { Console.Write("\n\t\t\"\"Bill\"\"\n"); Console.Write("\nItem Name\tPrize\tQuantity\tTotal\n"); for(int i=0;i<4;i++) Console.Write("\n{0}\t\t{1}\t{2}\t\t{3}",items[i],prize[i],Qty[i ],total[i]); Console.WriteLine("\n\n Total Bill Amount is {0} Rupees ", Total); } } }

OUTPUT:

Ex No : 19

PRINT BOOK DETAILS

13 -07-2012 AIM: To write a console application for printing book details. CODING: using System; using System.Collections.Generic; using System.Text; namespace Book_Details { class Program { static void Main(string[] args) { String s; int i, n,ch; book[] b = new book [10]; Console.Write("Enter Total Books : "); s = Console.ReadLine(); n = int.Parse(s); for (i = 1; i <= n; i++) { b[i] = new book(); Console.Write("\nEnter Details for BOOK {0}.....", i); b[i].Input(); } Console.Write("\nChoose 1 For Display 1 Book or 0 for Display All Bo oks "); s = Console.ReadLine(); ch = int.Parse(s); if (ch == 1) { Console.Write("\nEnter the Book Id for Searching : "); s = Console.ReadLine(); b[i] = new book(); for (i = 1; i <= n; i++) if (s == b[i].Id) b[i].Display(); } else if(ch==0) { for (i = 1; i <= n; i++) b[i].Display(); } Console.ReadKey(); } } class book { String Author, Title; public String Id; int Prize, Pages; public book() {

Author = "\0"; Title = "\0"; Id = "\0"; Prize = 0; Pages = 0; } public void Input() { String s; Console.Write("\n\nEnter ID of The Book : "); Id = Console.ReadLine(); Console.Write("Enter Book Name : "); Title = Console.ReadLine(); Console.Write("Enter Author Name : "); Author = Console.ReadLine(); Console.Write("Enter Total Pages : "); s = Console.ReadLine(); Pages = int.Parse(s); Console.Write("Enter Prize : "); s = Console.ReadLine(); Prize = int.Parse(s); } public void Display() { Console.Write("\n\nBook ID = {0}", Id); Console.Write("\nBook Name = {0}", Title); Console.Write("\nAuthor Name = {0}", Author); Console.Write("\nPrize = {0}", Prize); Console.Write("\nPages = {0}", Pages); } } }

OUTPUT:

You might also like