Friday, 6 December 2013
TO DOWNLOAD THE MOVIES IN HIGH CLEARITY
GO TO MOVIESNHACK
LINK IS:- http://www.moviesnhacks.com/
TO DOWNLOAD A MOVIE IN FEW DAYS AFTER RELEASING THE MOVIE
GO TO FZMOVIES.NET
LINK:- http://fzmovies.net/
TO DOWNLOAD SERIALS
GO TO FZTVSERIES
LINK:- http://www.fztvseries.mobi/
LINK IS:- http://www.moviesnhacks.com/
TO DOWNLOAD A MOVIE IN FEW DAYS AFTER RELEASING THE MOVIE
GO TO FZMOVIES.NET
LINK:- http://fzmovies.net/
TO DOWNLOAD SERIALS
GO TO FZTVSERIES
LINK:- http://www.fztvseries.mobi/
ARITHEMATIC PROGRAM IN C#
Question 1:- write a program that should accept two numbers from the users and perform the following mathematical operation-
v Addition
v Subtraction
v Multiplication
v Division
Answer :-
class Program
{
int num1, num2, result;
char ch;
public void accept()
{
Console.WriteLine("Main menu");
Console.WriteLine("1:- addition");
Console.WriteLine("2:- subtraction");
Console.WriteLine("3:- Multiplication");
Console.WriteLine("4:- division");
Console.WriteLine("pleasee enter our choicee");
Ch = Convert.ToChar(Console.ReadLine());
}
public void display()
{
Console.WriteLine("enter the first number");
num1 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("enter the second number");
num2 = Convert.ToInt32(Console.ReadLine());
}
public void output()
{
switch (ch)
{
case '1':
{
result = num1 + num2;
Console.WriteLine("result=" + result);
break;
}
case '2':
{
result = num1 - num2;
Console.WriteLine("result=" + result);
break;
}
case '3':
{
result = num1 * num2;
Console.WriteLine("result=" + result);
break;
}
case '4':
{
result = num1 / num2;
Console.WriteLine("result=" + result);
break;
}
default:
{
Console.WriteLine("invalid choice");
break;
}
}
}
static void Main(string[] args)
{
Program cal = new Program();
cal.accept();
cal.display();
cal.output();
Console.ReadLine();
}
}
Question 2:- write a program to identify the largest of three numbers enter by user. Create a program using methods.
Answer :-
class Program
{
int num1, num2, num3;
public void accept()
{
Console.WriteLine("enter the first number");
num1 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("enter the second number");
num2 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("enter the third number");
num3 = Convert.ToInt32(Console.ReadLine());
}
public void display()
{
if(num1>num2 && num1>num3)
{
Console.WriteLine("first number is largest"+num1);
}
else if(num2>num1 && num2>num3)
{
Console.WriteLine("second number is largest"+num2);
}
else
{
Console.WriteLine("third number is largest"+num3);
}
}
static void Main(string[] args)
{
Program d = new Program();
d.accept();
d.display();
Console.ReadLine();
}
}
Question 3- predict the output of the following program-
class Program
{
int number;
public void square(int number)
{
Console.WriteLine("the numbeer is :{0}", number);
number *= number;
Console.WriteLine("the square of 10 is :{0}", number);
}
Program()
{
number=10;
square(number);
}
static void Main(string[] args)
{
Program cal = new Program();
Console.ReadLine();
}
}
Answer :-
The number is :10
The square of 10 is :100
Question 4:- predict the output of the following program-
class Program
{
static int number1;
public void display(int number)
{
Console.WriteLine(number);
}
Program()
{
number1++;
display(number1);
}
static Program()
{
number1 = 10;
number1++;
}
static void Main(string[] args)
{
Program cal1 = new Program();
Program cal2 = new Program();
Console.ReadLine();
}
}
Answer :- 12
13Question 5:- As a part of the team that is developing software for library, you have been assigned the task of writing a program, the program should accept the following book detail.
Ø Book number as int
Ø Book category (fiction or notification) as string
Ø Author name as string
Ø Number of copy available as int
Write the program to accept and display the preceding book details.
Answer :-
class Program
{
int book_number;
string book_categary;
string auther_naame;
int number_of_copy;
public void accept()
{
Console.WriteLine("enter the book number");
book_number = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("enter the bool categary");
book_categary = Console.ReadLine();
Console.WriteLine("enter the auther name");
auther_naame = Console.ReadLine();
Console.WriteLine("ente the number of copy");
number_of_copy = Convert.ToInt32(Console.ReadLine());
}
static void Main(string[] args)
{
Program d = new Program();
d.accept();
Console.ReadLine();
}
}
Question 6:- write the program that accept distance in kilometer, convert it into meter, and then display the result.
Answer :-
class Program
{
int distance, result;
public void accept()
{
Console.WriteLine("enter the distance in kilometer");
distance = Convert.ToInt32(Console.ReadLine());
}
public void display()
{
result = distance * 1000;
Console.WriteLine("after cinvert kilometer into meter" + result);
}
static void Main(string[] args)
{
Program d = new Program();
d.accept();
d.display();
Console.ReadLine();
}
}
Question :- write a program that display “Congratulation You Have Cleared This Level. Entering Level2…..?” in red color.
Answer :-
class Program
{
static void Main(string[] args)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Congratulation! You Have Cleared Level.\n\n\tentring Leveel2.....?");
Console.ReadLine();
}}
FEATURES OF JAVA
FEATURES OF JAVA
1) SUPPORTS 100% OBJECT ORIENTED PROGRAMMING LANGUAGE
2)BASIC FEATURES ARE
1) SUPPORTS 100% OBJECT ORIENTED PROGRAMMING LANGUAGE
2)BASIC FEATURES ARE
- INHERITANCE : inherting the features of one class into the other class
- CLASS :- collection of data members and member functions
- OBJECT : instance of class that is created to access the class members.
- ACCESS MODIFIERS:- public, private, protected, default
- ENCAPSULATION:- wrapping up of data into sigle unit e.g. class
- INTERFACE :- it is like a class in which only members are declared that can be used in class
- DATA HIDING :- Hiding some of the dtaa or features by giving access modifier
- ABSTRACTION :- data hiding is abstraction
- POLYMORPHISM :- many forms e.g. function overloading, function overriding
TELEPHONE DIRECTORY IN C#
TELEPHONE DIRECTORY IN C#(PROGRAMMING)
DONE BY:- ANKUR SINGH
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace mobile_no
{
// MAKING THE CLASS
class Program
{
string mobile;
string name;
string age;
string address;
char ch;
string category;
//FUNCTION FOR ENTERRING THE DATA************************
public void getdata()
{
Console.Clear();
Console.ForegroundColor = ConsoleColor.Cyan;
ch = 'y';
DateTime tt = new DateTime();
tt = Convert.ToDateTime(DateTime.Now.ToLongTimeString());
while (ch == 'y' || ch == 'Y')
{
Console.ForegroundColor = ConsoleColor.Gray;
Console.WriteLine("\n ENTER YOUE NAME");
name = Console.ReadLine();
while (name.Length == 0)
{
Console.WriteLine("\nPLEASE ENTER THE CORRECT NAME");
name = Console.ReadLine();
}
Console.ForegroundColor = ConsoleColor.DarkGreen;
Console.WriteLine("\nENTER YOUR MOBILE NUMBER");
mobile = Console.ReadLine();
while (mobile.Length != 10)
{
Console.WriteLine("\nPLEASE ENTER THE CORRECT MOBILE NUMBER");
mobile = Console.ReadLine();
}
Console.ForegroundColor = ConsoleColor.Magenta;
Console.WriteLine("\nENTER YOUR AGE");
age = Console.ReadLine();
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine("\nENTER THE CATEGORY O/R");
category = Console.ReadLine();
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("\nENTER YOUR ADDRESS");
address = Console.ReadLine();
while (address.Length == 0)
{
Console.WriteLine("PLEASE ENTER THE CORRECT AADDRESS");
address = Console.ReadLine();
}
Console.WriteLine("\n\t\t\t1.SAVE AND CONTINUE");
Console.WriteLine("\n\t\t\t2.EXIT WITHOUT SAVE");
int ch1;
ch1 = Convert.ToInt32(Console.ReadLine());
FileStream fs = new FileStream("telephone.txt", FileMode.Append, FileAccess.Write);
StreamWriter sr = new StreamWriter(fs);
switch (ch1)
{
case 1:
sr.WriteLine("\t\t\tDATE :- {0}\n", tt);
sr.WriteLine();
sr.WriteLine("\t\tMOBILE :- {0}", mobile);
sr.WriteLine("\t\tNAME :- {0}", name);
sr.WriteLine("\t\tAGE :- {0}", age);
sr.WriteLine("\t\tADDRESS :- {0}", address);
sr.WriteLine("\t\tCATEGORY :- {0}", category);
sr.WriteLine();
Console.WriteLine("YOU WANT TO ENTER MORE RECORDS Y/N");
ch = Convert.ToChar(Console.ReadLine());
sr.Close();
fs.Close();
break;
case 2:
sr.Close();
fs.Close();
break;
default: Console.WriteLine("PLEASE ENTER THE CHOICE AS 1 OR 2"); break;
}
FileStream fs1 = new FileStream("search.txt", FileMode.Append, FileAccess.Write);
StreamWriter sr1 = new StreamWriter(fs1);
switch (ch1)
{
case 1:
sr1.WriteLine("\n\t\t\tDATE :- {0}\n", tt);
sr1.WriteLine();
sr1.WriteLine("\t\tNAME :- {0}", name);
sr1.WriteLine("\t\tMOBILE :- {0}", mobile);
sr1.WriteLine("\t\tAGE :- {0}", age);
sr1.WriteLine("\t\tADDRESS :- {0}", address);
sr1.WriteLine("\t\tCATEGORY :-{0}", category);
sr1.WriteLine();
sr1.Close();
fs1.Close();
break;
case 2:
sr1.Close();
fs1.Close(); break;
default: Console.WriteLine("PLEASE ENTER THE CHOICE AS 1 OR 2"); break;
}
}
}
//*****************FUNCTION FOR SHOWING THE DATA FROM THE FILE
public void showdata()
{
Console.Clear();
FileStream fs = new FileStream("telephone.txt", FileMode.Open, FileAccess.Read);
StreamReader sr = new StreamReader(fs);
sr.BaseStream.Seek(0, SeekOrigin.Begin);
Console.ForegroundColor = ConsoleColor.Gray;
Console.WriteLine("\n\t\t\tSTUDENT DETAILS\n");
string str;
str = sr.ReadLine();
if (str == null)
{
Console.WriteLine("FILE IS EMPTY!!!!!!!!");
}
while (str != null)
{
Console.ForegroundColor = ConsoleColor.Magenta;
Console.WriteLine(str);
str = sr.ReadLine();
}
sr.Close();
fs.Close();
}
//******************FUNCTION FOR MODIFYING THE DATA****************
public void search_by_mobile()
{
FileInfo searchFile = new FileInfo("telephone.txt");
if (searchFile.Exists)
{
Console.WriteLine("FILE EXIST");
}
else
{
Console.WriteLine("FILE DOES NOT EXIST");
Environment.Exit(0);
}
Console.Clear();
//FileStream fs = new FileStream("telephone.txt", FileMode.OpenOrCreate, FileAccess.ReadWrite);
StreamReader sr = File.OpenText("telephone.txt");
sr.BaseStream.Seek(0, SeekOrigin.Begin);
Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine("ENTER MOBILE NUMBER TO SEARCH FOR THE SPECIFIC RECORD");
mobile = Console.ReadLine();
while (mobile.Length != 10)
{
Console.WriteLine("ENTER CORRECT MOBILE NUMBER TO CHANGE THE SPECIFIC RECORD");
mobile = Console.ReadLine();
}
Console.WriteLine("\n\t\tTHE STUDENT WITH MOBILE NUMBER {0}", mobile);
Console.WriteLine();
string str;
str = sr.ReadLine();
while (str != null)
{
if (str.Contains(mobile))
{
name = sr.ReadLine();
Console.WriteLine(name);
age = sr.ReadLine();
Console.WriteLine(age);
address = sr.ReadLine();
Console.WriteLine(address);
category = sr.ReadLine();
Console.WriteLine(category);
}
if (str == null)
{
Console.ForegroundColor = ConsoleColor.DarkRed;
Console.WriteLine("\n\t\t!!!!!!WARNING:- PLEASE ENTER THE CORRECT MOBILE NUMBER");
break;
}
str = sr.ReadLine();
}
sr.Close();
}
public void search_by_name()
{
FileInfo searchFile = new FileInfo("search.txt");
if (searchFile.Exists)
{
Console.WriteLine("FILE EXIST");
}
else
{
Console.WriteLine("FILE DOES NOT EXIST");
Environment.Exit(0);
}
Console.Clear();
StreamReader sr = File.OpenText("search.txt");
sr.BaseStream.Seek(0, SeekOrigin.Begin);
Console.ForegroundColor = ConsoleColor.DarkMagenta;
Console.WriteLine("ENTER THE NAME TO SEARCH FOR THE SPECIFIC RECORDS");
name = Console.ReadLine();
while (name.Length == 0)
{
Console.WriteLine("ENTER CORRECT NAME TO SEARCH THE SPECIFIC RECORD");
name = Console.ReadLine();
}
Console.WriteLine("\n\t\tTHE RECORD OF {0}", name);
Console.WriteLine();
string str;
str = sr.ReadLine();
if (str == null)
{
Console.WriteLine("\t\t*******NO DATA EXIST*******");
Environment.Exit(0);
}
while (str != null)
{
if (str.Contains(name))
{
mobile = sr.ReadLine();
Console.WriteLine(mobile);
age = sr.ReadLine();
Console.WriteLine(age);
address = sr.ReadLine();
Console.WriteLine(address);
category = sr.ReadLine();
Console.WriteLine(category);
string mobile1;
Console.WriteLine("enter the new mobile");
mobile1 = Console.ReadLine();
Replace(mobile, mobile1);
}
str = sr.ReadLine();
}
sr.Close();
}
public void help()
{
Console.Clear();
Console.ForegroundColor = ConsoleColor.Magenta;
Console.WriteLine("This software is used to create a telephone bill for the customers.\n ");
Console.ForegroundColor = ConsoleColor.DarkCyan;
Console.WriteLine("There are two catagories of the customers. First catagories is of\n");
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("Residential phones and second catagories is of Office phones. Both\n");
Console.ForegroundColor = ConsoleColor.Gray;
Console.WriteLine("the catagories have same charges of the telephone bill. Charges\n");
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine("of residential phones are 1 RS per call and Charges of Office \n");
Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine("office phones are Rs. 1 per call. 150 call are free for each catogory\n");
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Total bill for is equal to 5% tax plus 100 rupees charges for other\n");
Console.ForegroundColor = ConsoleColor.Gray;
Console.WriteLine("charges. If bill is not paid before the paticular date then penalty \n");
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("should also be given.\n");
}
public void bill()
{
string mobile;
int no;
double bill = 0.0, tax = 0.0, fine = 0.0, bbill = 0.0, abill = 0.0;
FileStream fs = new FileStream("telephone.txt", FileMode.Open, FileAccess.Read);
StreamReader sr = new StreamReader(fs);
sr.BaseStream.Seek(0, SeekOrigin.Begin);
Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine("ENTER MOBILE NUMBER TO SEARCH FOR THE SPECIFIC RECORD");
mobile = Console.ReadLine();
while (mobile.Length != 10)
{
Console.WriteLine("ENTER CORRECT MOBILE NUMBER TO CHANGE THE SPECIFIC RECORD");
mobile = Console.ReadLine();
}
Console.WriteLine("\n\t\tTHE STUDENT WITH MOBILE NUMBER {0}", mobile);
Console.WriteLine();
string str;
str = sr.ReadLine();
while (str != null)
{
if (str.Contains(mobile))
{
name = sr.ReadLine();
Console.WriteLine(name);
age = sr.ReadLine();
Console.WriteLine(age);
address = sr.ReadLine();
Console.WriteLine(address);
category = sr.ReadLine();
Console.WriteLine(category);
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine("No. of calls ");
no=Convert.ToInt32(Console.ReadLine());
if (no <= 150)
{
bill = 0;
}
else
{
no = no - 150;
bill = no * 1.00;
}
Console.Write("\nBill :- {0} RS",bill);
tax = (5 * bill) / 100;
Console.WriteLine("\t\t5% Tax :- {0} RS",tax);
Console.Write("Duties :- 100");
Console.ForegroundColor = ConsoleColor.DarkCyan;
DateTime dt=new DateTime();
dt=Convert.ToDateTime(DateTime.Now.ToLongTimeString());
Console.WriteLine();
Console.Write("TOTAL BILL before :- {0} ",dt);
bbill = bill+tax+100;
Console.WriteLine(bbill+" RS");
Console.WriteLine();
Console.Write("Late Fine :- ");
fine = (bbill*5)/100;
Console.WriteLine(fine);
Console.WriteLine();
Console.Write("TOTAL BILL after :- {0} ",dt);
abill = bbill+fine;
Console.WriteLine(abill+" RS");
}
if (str == null)
{
Console.ForegroundColor = ConsoleColor.DarkRed;
Console.WriteLine("\n\t\t!!!!!!WARNING:- PLEASE ENTER THE CORRECT MOBILE NUMBER");
break;
}
str = sr.ReadLine();
}
sr.Close();
}
public void deleter()
{
char ch;
FileStream temp = new FileStream("temp.txt", FileMode.Append,FileAccess.Write);
StreamWriter sr=new StreamWriter(temp);
FileStream fp = new FileStream("telephone.txt", FileMode.Open,FileAccess.Read);
StreamReader sr1=new StreamReader(fp);
sr1.BaseStream.Seek(0,SeekOrigin.Begin);
string str;
str=sr1.ReadLine();
if (str == null)
{
Console.Write("Unable to open Telephone file");
sr1.Close();
fp.Close();
}
Console.Write("Enter the Phone No. to be deleted : ");
mobile=Console.ReadLine();
while (str!=null)
{
if (str.Contains(mobile))
{
name = sr1.ReadLine();
Console.WriteLine(name);
age = sr1.ReadLine();
Console.WriteLine(age);
address = sr1.ReadLine();
Console.WriteLine(address);
category = sr1.ReadLine();
Console.WriteLine(category);
Console.Write("Delete this record (Y/N) ");
ch = Convert.ToChar(Console.ReadLine());
if (ch== 'N' || ch=='n')
{
sr.WriteLine(str);
}
}
else
{
sr.WriteLine();
}
str = sr1.ReadLine();
}
sr1.Close();
fp.Close();
sr.Close();
temp.Close();
FileStream fs = new FileStream("temp.txt", FileMode.Open, FileAccess.Read);
StreamReader sr2 = new StreamReader(fs);
sr2.BaseStream.Seek(0, SeekOrigin.Begin);
FileStream fs1 = new FileStream("telephone.txt", FileMode.Open, FileAccess.Write);
StreamWriter sr3 = new StreamWriter(fs1);
str = sr2.ReadLine();
while (str != null)
{
sr3.WriteLine(str);
str = sr2.ReadLine();
}
sr3.Close();
fs1.Close();
sr2.Close();
fs.Close();
}
}
class mobileno{
static void Main(string[] args)
{
Console.Clear();
FileStream FS = new FileStream("password.txt",FileMode.Open,FileAccess.Read);
StreamReader SR = new StreamReader(FS);
string password;
string str;
str = SR.ReadLine();
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine("\t******ENTER THE PASSWORD TO PROCEED******");
password=Console.ReadLine();
Console.Clear();
while (str != null)
{
if (str.Contains(password))
{
char ch = 'y';
while (ch == 'y' || ch == 'Y')
{
Console.Clear();
Program p = new Program();
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("\t\t\t\t\t\t\t\t MADE BY:-");
Console.ForegroundColor = ConsoleColor.DarkGray;
Console.WriteLine("\t\t\t\t\t\t\t\tANKUR SINGH");
Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine("\n\n\t\t***********TELEPHONE DIRECTORY***********\n\n");
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine("\t\t\tWhat you want to do\n");
Console.WriteLine("\t\t\t1. ENTER THE DATA\n");
Console.WriteLine("\t\t\t2.DISPLAY THE DATA\n");
Console.WriteLine("\t\t\t3.SEARCH THE RECORDS\n");
Console.WriteLine("\t\t\t4.DISPLAY THE BILL\n");
Console.WriteLine("\t\t\t5.HELP\n");
Console.WriteLine("\t\t\t6.EXIT\n");
Console.ForegroundColor = ConsoleColor.Yellow;
Console.Write("\nPLEASE ENTER YOUR CHOICE :- ");
int A;
A = Convert.ToInt32(Console.ReadLine());
int CH2;
switch (A)
{
case 1: p.getdata(); break;
case 2: p.showdata(); break;
case 3:
CH2 = 1;
while (CH2 != 3)
{
Console.WriteLine("\n\t\t\t1 - SEARCH RECORD BY MOBILE NUMBER");
Console.WriteLine("\n\t\t\t2 - SEARCH RECORD BY CUSTOMER NAME");
Console.WriteLine("\n\t\t\t3 - Quit");
Console.WriteLine("SELECT YOUR OPTION");
CH2 = Convert.ToInt32(Console.ReadLine());
switch (CH2)
{
case 1: p.search_by_mobile();
break;
case 2: p.search_by_name();
break;
}
}
break;
case 4: p.bill(); break;
case 5: p.help(); break;
case 6: Environment.Exit(0); break;
default: Console.WriteLine("PLEASE ENTER THE CORRECT CHOICE");
break;
}
Console.WriteLine();
Console.WriteLine("DO YOU WANT TO ENTER ANOTHER CHOICE Y/N");
ch =Convert.ToChar(Console.ReadLine());
}
}
if(!str.Contains(password)){
Console.WriteLine("WRONG PASSWORD");
Environment.Exit(0);
}
}
SR.Close();
FS.Close();
Console.ReadLine();
}
}
}
Subscribe to:
Comments (Atom)