Likes

C# LAB at HoM 18.

Ryan wants to make his desktop comfortable to work. For this, he wants the following settings on his computer: The Paint icon should appear on the taskbar. The taskbar should not be visible when the user is working on the applications. Two recently used program icons should be displayed on the Start menu. The Start menu should have the System administrative tools option. Icons of his favorite games, FreeCell and Solitaire, should be available on top of the Start menu so that he does not have to locate them in the All Programs menu. Help Ryan to accomplish the preceding tasks. Hint 1: Change the settings of the taskbar by opening the Taskbar and Start Menu Properties dialog box. Hint 2: Open the Customize Start menu dialog box through the Taskbar and Start Menu Properties dialog box.


Right-click the taskbar.

1.Select properties.
  the taskbar and start menu properties dialog box is displayed.
2.select the Auto-hide the taskbar check box.
3.click the Apply button.
4.Ensure that the Always combine, hide labels option is selected in
   the Taskbar buttons drop-down list.
5.click the Start Menu teb.
6.click the Customize button.
  the Customize Start Menu dialog box is displayed.
7.Type 2 in the Number of recent programs to display spin box.
  Scroll to the end of the list to locate the System administrative
  tools category.
8.select the Display on the All programs menu and the Start menu option.
9.click the OK button.
10.click the OK button.
11.select Start.
12.select All programs.
13.select Accessories.
14.select Paint and then drag it to the taskbar.
     (this is the paint to pin to Taskbar copy stor to dastop to icon to paint paste)
15.You can see the Paint icon on the Taskbar.
16.select Start.
17.select Control Panel.
    the All Control Panel Items window is displayed.
18.Ensure that Category is selected in the view by drop-down list.
19.click the programs link.
    the programs window is displayed.
20.click the Turn Windows features on or off link.
     The Windows Features window is displayed.
21.select the Games check box.
22.click the OK button.
     The Microsoft windows message box is displayed showing the progress bar.
23.close the programs window.
24.select Start.
25.select the All programs.
26.select games.
27.Right-click the FreeCell icon.
28.select pin to start Menu.
29.Right-click the Solitaire icon.
30.select pin to Start Menu.
31.click the Back button.
    the freeCell and Solitaire icons are Displayed
     on the Start menu.





Write a program, to create two custom attributes, BugFixingAttribute and DescriptionAttribute, to be assigned to class members. Add the two attributes together in a single application.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Attribute_example
{
        [AttributeUsage(AttributeTargets.Class|AttributeTargets.Constructor|AttributeTargets.Field|AttributeTargets.Method|AttributeTargets.Property,AllowMultiple=true)]
        public class BugFixingAttribute:System.Attribute
        {
            private int bugNo;
            private string developer;
            private string dataFixed;
            public string remarks;
            public BugFixingAttribute(int BugNo,string Developer,string DataFixed)
            {
                this.bugNo=BugNo;
                this.developer=Developer;
                this.dataFixed=DataFixed;
            }
            public int BugNo
            {
                get
                {
                    return bugNo;
                }
            }
            public string DataFixed
            {
                get
                {
                    return dataFixed;
                }
            }
            public string Developer
            {
                get
                {
                    return Developer;
                }
            }
            public string Remarks
            {
                get
                {
                    return remarks;
                }
               set
                {
                    remarks= value;
                }
            }
        }
        [BugFixingAttribute(125,"Sara Levo","18/06/2012",Remarks="Return object not specified")]
        public class Calculator
        {
            public double Add(Double num1,Double num2)
            {
                return num1+num2;
            }
            public double subtract(Double num1,Double num2)
            {
                return num1-num2;
            }
            [BugFixingAttribute(155,"Sara Levo","20/06/2012")]
            public double Divide(Double num1,Double num2)
            {
                return num1*num2;
                ;
            }
            [BugFixingAttribute(156, "Sara Levo", "20/06/2012")]
            public double divide(Double num1, Double num2)
            {
                return num1 / num2;
            }
        }
        public class EntryPoint
        {
       public static void Main()
        {
            Calculator Myobj=new Calculator();
            Console.WriteLine("The sum of specified two nos are:{0}",Myobj.Add(15,20.5));
            Console.ReadLine();
        }
    }
}

C# LAB at HoM 17.

Sandy is creating a project report by using a computer running Windows 7 as its operating system. To avoid any error in the final project report, he wants to take backup of the project data to a desired location at regular intervals of time. Further, he wants to restore the backup data. Help Sandy to accomplish the preceding requirements. Hint 1: The Backup and Restore link can be used to backup and restore data. Hint 2: The Backup and Restore link can be accessed from the Control Panel window.


1.select Start.
2.select Control panel.
  the all cotrol panel ltems window is displayed.
3.click the Backup and Restore link.
  the backup and restore window is displayed.
4.click the set up backup link.
  the set up backup dialog box is displayed.
  the select where you want to save your backup page is displayed.
  select the drive where the backup data will be stored.
5.click the next button.
  the whet do you want to back uo? page is displayed.
6.select the let me choose option.
7.click the next button.
  the set up backup dialog box is displayed.
  the what do you want to back up? page is displayed.
  select the chect box for the drive where the data to be back up is stored.
8.click the next button.
  the review your backup setting page is displayed.
9.click the seve setting and run backup button.
  the backup and restore window is displayed.
  wait for the back up process to complete.
  close the backup and restore window.
10.select start.
11.select control panel.
   the all cotrol panel ltems window is displayed.
12.click the Backup and Restore link.
   the backup and restore window is displayed.
13.click the restore my files button.
  the restore file dialog box is displayed.
14.click the browse for folders button.
  the browse the backup for folders or drives dialog box is displayed.
  select the folder or drive to be restored.
15.click the folder button.
16.click the next button.
  the where do you to restore your files? page is displayed.
  Ensure that the in the original location option is selected.
17.click the restore button.
  the Restoring files page is displayed.
  the copy file dialog box is displayed.
18.select the do this for all conflicts check box.
19.click the do not copy button.
  the your files have been restored page is displayed.
20.click the finish button.
  close the backup and restore window.





Write an application that creates a class named Registration. The application would be used by the counselors of an IT education center, while registering students. The registration data entry is done differently for Career registration and for Modular registration. Your application should have separate class for the two categories of students. In case of Career registration, you need to record the student's marks of the aptitude test. In case of Modular registration, you need to record the student's prior experience or knowledge. Hint: Use delegate in the Registration class while registering a student to call the appropriate methods.


using System;
namespace DelegateExample
{
class DelegateExample
{
public abstract class Student {  }
public class Modular:Student
{
public void GetExperience()
{
string name;
string experience;
Console.WriteLine("Enter your name");
name=Console.ReadLine();
Console.WriteLine("Enter the experience of the student in years:");
experience=Console.ReadLine();
Console.WriteLine("\n{0} has {1} experience",name, experience);
}
}
public class General : student
{
public void Aptitute()
{
string name;
string marks;
Console.WriteLine("n\Enter your name:");
name=Console.ReadLine();
Console.WriteLine("Enter the marks of the aptitude test:");
marks=Console.ReadLine();
Console.WriteLine("\n{0} has got {1} marks in the aptitude test",name,marks);
}
}
public class Registration
{
public delegate void RegistrationType();
public RegistrationType Register;
public void DoRegistration(RegistrationType R)
{
Register =R;
}
public void DoNextRegistration()
{
if (Register!=null)
{
Register();
}
}
}
static void Main (string [] args)
{
string s;
Console.WriteLine("Enter the Registration type(career/Modular):");
s=Console.ReadLine().ToUpper();
Registration Reg=new Registration();
Modular Mod=new Modular();
General Gen=new General();
if (s=="MODULAR")
{
Reg.DoRegistration (new Registration.RegistrationType(Mod.GetExperience));
Reg.DoNextRegistration();
}
else if(s=="CAREER")
{
Reg.DoRegistration(new Registration.RegistrationType(Gen.Aptitute));
Reg.DoNextRegistration();
}
else
Console.WriteLine("Invalid registration type");
Console.ReadLine();
}
}
}

C# LAB at HoM 16.

Write an application to simulate the vehicles crossing a toll bridge on a motorway. For the purpose of this exercise, simulate the environment for five vehicles that are approaching the bridge and the toll booth. The vehicles are numbered from one to five. The vehicles have to go through the following five stages: Start the journey Arrive at the toll Enter the toll booth Exit the toll booth Cross the bridge The vehicles can be in any of the stages in parallel, except the third stage as only one vehicle can enter the toll booth at a time. The simulation is performed by having one thread for each vehicle, and consists of the following classes: Vehicle: Simulates the behavior of a vehicle. TollBooth: Simulates the behavior of a toll booth. Simulate: Creates the vehicles and controls the simulation.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    public class vehical
    {
        private int id;
        private static TollBooth = new TollBooth();
        public vehicle(int id)
        {
            this.id=id;
        }
        public void exec()
        {
            Console.WriteLine("vehicle {0} starts journey",id+1);
            Random RandGen = new Random();
            int Rnd=RandGen .Next(0,100);
            travel (Rnd);
            Console.WriteLine("vehicle {0} arrives at the toll ", id+1);
            toll.useToll(this);
            travel (Rnd);
            Console.WriteLine("vehicle {0} has crossed the bridge ",id+1);
        }
        public int getVehicleId()
        {
            return this.id;
        }
        public void travel (int time)
        {
            int limit =500000;
            for(int j=0; j<time;j++)
            {
                for(int k =0 ; k<limit;k++)
                    (// do nothing);
                }
            }
    }
    public class TollBooth
    {
        bool inUse;
        
        public TollBooth()
        {
            inUse=false;
        }
        public void useToll(Vehicle vehicle)
        {
            if(inUse==false)
            {
                inUse=true;
                Console.WriteLine("vehicle {0} enters tollbooth ", vehicle.getVehicleId()+1);
                vehicle.travel(50);
                Console.WriteLine("Vehicle {0} exits tollbooth ",vehicle.getVehicleId()+1);
                inUse=false;
                break;
            }
        }
    }
}
public class Simulate
{
    private static int noOfVehicles =5;
    private static Vehicles[] vehicles;
    public static void Main(string[]args)
    {
        try
        {
            Simulate sm=new Simulate();
            vehicles=new Vehicles[5];
            for(int i=0;i<noOfVehicles;i++)
            {
                vehicles[i]=new Vehicles(i);
                Thread t=new Thread(new ThreadStart(vehicles[i].exec);
                t.Start();
                Thread.Sleep(100);
            }
            Console.ReadLine();
        }
        catch (Exception ex)
        {
            System.Console.WriteLine(ex);
        }
    }
}





To access the Internet, Sandy uses a computer on which the Windows 7 operating system is installed. His friend, John asks Sandy to allow him to use his computer for accessing the Internet. Before handing over the computer to John, Sandy has to ensure that the private data and browsing history are not accessible to John. Therefore, he wants to perform the following tasks: Delete saved passwords in the browser. Delete browsing history. Delete download history. Increase the space for temporary files. Increase the number of days for which the browsing history is kept. Block the pop-up windows. Help Sandy to accomplish the preceding tasks. Prerequisite:To perform this exercise, you need to have Internet Explorer version 9 installed on your host machine. Hint 1: Delete the browsing history using the Internet Options dialog box. Hint 2: Enable pop-up blocking using the Tools menu.


1. select Start.
2. select All programs.
3.select Internet Explorer.
  The Internet Explorer window is displayed.
4. select tools.
5. select Delete browsing history.
   the delete Browsing History dialog box is displayed.
6. Ensure that the Temporary Internet file check box is selected.
7. Ensure that the History check box is selected.
8. select the Passwords check box.
9. click the Delete button.
10. select Tools.
11. select Internet options.
  the internet Options Dialog box is displayed.
12. click the Settings button.
    the Temporary Internet file and History Setting dialog box is pisplayed.
13. Replace value in the Disk space to use spin box with 500.
14. Ensure that the value in the Days to keep pages in history spin box is 20.
15. click the ok button
    the Internet options dialog box is displayed again.
16. click the privacy tab.
17. Ensure that the Turn on pop-up Blocker check box is selected.
18. click the ok button.
    close the internet Explorer window.

C# LAB at HoM 15

Sandy has bought a game and wants to install it on his computer, which has Windows 7 operating system installed on it. However, he needs to ensure if his computer meets the minimum processing requirements for the game. In addition, he wants to clean up the unused files of the C: drive of his computer to improve the computer's performance. Help Sandy to accomplish the preceding tasks. Hint 1: The Windows Experience Index link can be used to check the performance capabilities of a computer. Hint 2: The Disk Cleanup utility can be used to delete the unused files from a drive.


1.select start.
2.select Control panel.
The all Control panel ltems window is displayed
3.click the system link.
The system window is displayed
4.click the window Experience index link.
the performance information and Tools window is displayed.
the window displays the score for the different components of the computer.
5.close the performance information and tools window.
6.select start.
7.select all program.
8.select Accessories.
9.select system tools.
10.select Disk Cleanup.
  the Disk Cleanup: Drive selection dialog box is displayed.
  Ensure that the C: drive is selected from the Drives drop-down list.
11.click the OK button.
  the disk Cleanup message is displayed
  the disk Cleanup for (C:) dialog box is displayed.
12.click the OK button.
  the disk Cleanup dialog box is displayed.
13.click the delete Files button.
  the disk Cleanup dialog box is displayed.
  all the unnecessary files are deleted permanently.





David wants to create a ticket booking application for a movie theater. The application should ask the user for his choice, whether he wants to book the tickets or not. The application should also ask the user for the total number of tickets to be booked. While booking the tickets, if the total number of booked tickets exceeds the available tickets, the application should raise an exception and display an appropriate message. Hint: The total number of available tickets is 10.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication9
{
    class TicketLimit
    {
        static void Main(string[] args)
        {
            Summer Summer = new Summer();
            try
            {
                Summer.CalculateTicket();
            }
            catch (TicketLimt e)
            {
                Console.WriteLine(e.Message);
                Console.ReadLine();
            }
        }
    }
    public class TicketLimt : ApplicationException
    {
        public TicketLimt(string massage)
            : base(massage)
        {

        }
    }
    public class Summer
    {
        int TotalTickets = 10;
        int count = 0;
        char choice = 'Y';
        public void CalculatetICKET()
        {
            while (true)
            {
                Console.WriteLine("dO you want to book the tickets(Y/N)");
                choice = Convert.ToChar(Console.ReadLine());
                if (choice == 'Y' || choice == 'Y')
                {
                    Console.WriteLine("Only {0} tickets are available", TotalTickets);
                    Console.WriteLine("enter the number of tickets you want to book");
                    count = Convert.ToInt32(Console.ReadLine());
                    if (count > TotalTickets)
                        throw (new TicketLimt("Tickets not available"));
                    else
                        TotalTickets -= count;
                }
                else
                    break;
            }
        }
    }
}

C# LAB at HoM 14

Sandy is managing a Windows 7 computer. He needs to use security software to help protect the computer from viruses, spyware, and other security threats without additional cost. He wants to use a solution, which can provide real-time protection and post infection scanning and removal of threats from the computer. Therefore, he wants to configure the following settings on the computer using the Windows Defender feature: Windows Defender should run daily at 1:00 PM on its own by using quick scan mode. Windows Defender should check for the updated definitions before scanning. A scan should be run only when the computer is idle to maintain the performance of computer. A protection should be applied on the system while files and attachments are being downloaded. Archive files, such as .zip or .cab, should be scanned. Email content or attachments should be scanned. The remaining settings of Windows Defender should remain unaltered. After configuring the preceding settings, the computer should be scanned and the result should be observed. Help Sandy to configure Windows Defender to protect his system as per the preceding requirements. Hint 1: Select Start->Control Panel->Windows Defender->Tools and Settings. Hint 2: Select Start->Control Panel->Windows Defender->Scan.


1.select start.
2.select Control panel
  the Control panel Window is displayed
3.select Large icons.
4.Click the windows Defender link
protection against spyware and potentially unwanted software.
the windows defender message box is displayed
5.click the click here to turn it on link.
6.select tools.
7.click the Options link
   Ensure that Automatic scanning is selected in the left pane
   Ensure that Automatically scan my Computer (Recommended) check box selected
   Ensure that is selected in the Frequency droy-down list
8.select 13.00 from the Approximate time drop-down list
9.select Real-time protection
  Ensure that the Use real-time protection (Recommended) check box is selected.
10.select Advanced.
   Ensure that the Scan archive files check box selected
    select the scan e-mail check box
11. click the save button.
12. select scan.
    the scanning process is started
    Wait for the scnning process to end
    Observe the result
    close the Windows Defender window

   Close the Control panel window





You need to generate a program to play the Hangman game. The program asks a user to enter a category as Book or Movie. Based on the category provided, a book name or movie name is extracted from a file containing a list of movie and book names and the user is asked to guess the name by typing one character at a time. Develop the Hangman game application. Prerequisite: You will require the TextTest.txt file for this exercise. Click the TextTest.zip link to download the TextTest.txt file.


using System;
using System.IO;
namespace name_1
{
    public class Hangman
    {
        string randomString, userString;
        int dataLength;
        string Category;
        string[] bookData = new string[5];
        string[] movieData = new string[5];
        int bookCount = 0, movieCount = 0;
        public Hangman()
        {
            FillNameValues();
        }
        private void FillNameValues()
        {
            string firstLine;
            StreamReader sRead =new StreamReader("c:\\Texttest.txt");
            sRead.BaseStream.Seek (0,SeekOrigin.Begin);
            firstLine = sRead.ReadLine();
            while(firstLine != null)
            {
                if (firstLine.Substring (0,1) =="B")
                {
                    int stringStratPos=firstLine.IndexOf(':');
                    bookData[bookCount] = firstLine.Substring(stringStratPos+ 1);
                    bookCount++;
                }
                else
                {
                    int stringStartPos=firstLine.IndexOf(':');
                    movieData[movieCount]=firstLine.Substring(stringStartPos+1);
                    movieCount++;
                }
                firstLine=sRead.ReadLine();

           


    }
}
 public int AcceptCategory()
 {
     Console.WriteLine("enter the category to play-book/movie");
     Category=Category.ToUpper();
     if (Category!="BOOK"&& Category!="MOVIE")
     {
         Console.WriteLine("Invalid category.......\n");
         return 0;
     }
     else
     {
         ExtractName();
         return 1;
     }
 }
        public void ExtractName()
        {
             Random RandGen=new Random();
            if (Category=="BOOK")
            {
             
                int Rnd=RandGen.Next(0,bookCount-1);
                randomString=bookData[Rnd];
            }
        }
        public void StartGame()
        {
            dataLength=randomString.Length;
            char locatechar;
            int correctCnt=0,inCorrectCnt=0;
        int i,k;
        char [] s=new char[randomString.Length];
        InitializeUserString();
        showUserInputString();
        if (Category=="BOOK")
    {
        Console.WriteLine("the total number of characters in the Book:{0}",randomString.Length);
        Console.WriteLine("the total number of characters you can enter to guess the name of Book: {0}",randomString.Length+2);
    }
    else
{
    Console.WriteLine("the total number of characters in the Movie:{0}",randomString.Length);
     Console.WriteLine("the total number of characters you can enter to guess the name of Movie:{0}",randomString.Length+2);

}
    for (i =1,k=0;i<=dataLength+2||k==dataLength;i++)
{
 if (correctCnt == dataLength || inCorrectCnt ==dataLength)
    break;
    Console.WriteLine("Enter the char ");
    locatechar = Convert.ToChar(Console.ReadLine().ToLower());
    int foundPos=0;
    int foundChar=0;
        {
    if (c== locatechar)
{
    UpdateDtring (foundPos,locateche.ToString());
    k++;
    foundChar=1;
}
    foundPos++;
}
    if (foundChar == 0)
{
    inCorrectCnt++;}
    else
{
    correctCnt++;
}
    showUserInputString();
    Console.WriteLine("Total Correct Attempts:{0}\t",correctCnt);
    Console.WriteLine("Total InCorrect Attempts:{0}\n", inCorrectCnt);
    if (k == dataLength)
    break;
}
if (randomString == userString)
{
Console.WriteLine("You have Won \n");
}
else{
Console.WriteLine("The Correct name is {0}",randomString);
Console.WriteLine("You have lost\n");
}
}
private void UpdateDtring (int fPos, string updateStr)
{
string beforeString, afterString;
if(fPos!=0&&fPos!=dataLength-1)
{
if (fPos==1)
beforeString=userString.Substring(0,1);
else
beforeString=userString.Substring(0,fPos);
afterString=userString.Substring(fPos+1,dataLength-(fPos));
userString=updateStr+afterString;
}
if (fPos==dataLength-1)
{
beforeString.userString.Substring(0,fPos);
userString=beforeString+updateStr;
}    
}
public void InitializeUserString()
{
userString="           ";
for (int i=0;i<dataLength;i++)
{
userString=userString.Insert(i,"*");
}
}
public void showUserInputString()
{
Console.WriteLine("input value:{0}\n\n",userString);
}
    }
    class Game
{
string void Main (string[]args)
{
Console.Clear();
Hangman obj=new Hangman();
int returnVal=obj.AcceptCategory();
if (returnVal==1)
{
obj.StartGame();


Console.ReadLine();}
}
}
}

C# LAB at HoM 13

david is a team leader of XYZ organization. He wants to create a scheduler,which will store fields, such as the appointment date,the name of the person to meet, and time.He needs to develop an application that wiil enable the user to fill fields.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace Chap7_A1
{
    class Schedule
    {
        struct details
        {
            public DateTime Date;
            public string Appointment;
            public string Time;
            public string Day;
        };
        private details Testdetails;
        static FileStream F;
        StreamWriter W;
        StreamReader R;
        public void Getdata()
        {
            String Duedata;
            Console.Write("Apointment Date (MM/DD/YY) : ");
            Duedata = Console.ReadLine();

            if ((Duedata.Length) != 8)
            {
                Console.WriteLine("Incorrect format of date");
                Console.ReadLine();
                System.Environment.Exit(0);
            }
            if (((Duedata.Substring(2, 1)) != "/") || ((Duedata.Substring(5, 1)) != "/"))
            {
                Console.WriteLine("Incorrect format of date");
                Console.ReadLine();
                System.Environment.Exit(0);
            }
            try
            {
                Testdetails.Date = Convert.ToDateTime(Duedata);
            }
            catch (Exception e)
            {
                Console.WriteLine("Invalid Date");
                System.Environment.Exit(0);
            }
            Testdetails.Day =
                Convert.ToString(Testdetails.Date.DayOfWeek);
            Console.Write("Appointment with: ");
            Testdetails.Appointment = Console.ReadLine();
            Console.Write("Appoinment Time(hr:mn): ");
            Testdetails.Time = Console.ReadLine();

            if ((Testdetails.Time.Length) != 5)
            {
                Console.WriteLine("Incorrect formet of time");
                System.Environment.Exit(0);
            }
            if ((Testdetails.Time.Substring(2, 1)) != ":")
            {
                Console.WriteLine("Incorrect format of time");
                System.Environment.Exit(0);
            }
            F = new FileStream("MyFile.txt", FileMode.Append, FileAccess.Write);
            W = new StreamWriter(F);
            W.Write("Date:");
            W.Write(Testdetails.Date.ToShortDateString());
            W.Write("?");
            W.Write("Day: ");
            W.Write(Testdetails.Day);
            W.Write("?");
            W.Write("Name: ");
            W.Write(Testdetails.Appointment);
            W.Write("?");
            W.Write("Time: ");
            W.Write(Testdetails.Time);
            W.WriteLine("?");

            W.Flush();
            W.Close();
        }
        public void Display()
        {
            string Str;
            F = new FileStream("MyFile.txt",
            FileMode.OpenOrCreate, FileAccess.Read);
            R = new StreamReader(F);
            Console.Clear();
            int Pos = 0;
            while ((Str = R.ReadLine()) != null)
            {
                while (true)
                {
                    Pos = Str.IndexOf("?");
                    if (Pos == -1)
                        break;
                    Console.WriteLine(Str.Substring(0, Pos));
                    Str = Str.Substring(Pos + 1);
                }
                Pos = 0;
            }
            R.Close();
        }
        public void Search()
        {
            string Str, Chkstrl, Chkstr2;
            DateTime DD; int Pos;
            F = new FileStream("MyFile.txt", FileMode.Open,
                FileAccess.Read);
            R = new StreamReader(F);
            Console.Write("Enter Date (MM/DD/YY): ");
            DD = Convert.ToDateTime(Console.ReadLine());
            while ((Str = R.ReadLine()) != null)
            {
                Chkstrl = "Date: " + DD.ToShortDateString();
                Pos = Str.IndexOf("?");
                Chkstr2 = Str.Substring(0, Pos);
                if ((Chkstrl.CompareTo(Chkstrl)) == 0)
                {
                    while (true)
                    {
                        Pos = Str.IndexOf("?");
                        if (Pos == -1)
                            break;
                        Console.WriteLine(Str.Substring(0, Pos));
                        Str = Str.Substring(Pos + 1);
                    }
                    Pos = 0;
                }
            }
            R.Close();
        }
        static void Main(string[] args)
        {
            Schedule S = new Schedule();
            int Ch = 0;
            Console.Clear();
            while(Ch != 4)
            {
                Console.WriteLine("1. Add appointment");
                Console.WriteLine("2. View appointment");
                Console.WriteLine("3. Search");
                Console.WriteLine("4. Exit");
                Console.WriteLine("Enter Choice: ");
                Ch = Convert.ToInt32(Console.ReadLine());
                switch (Ch)
                {
                    case 1: Console.Clear(); S.Getdata();
                        Console.Clear();break;
                    case 2: Console.Clear(); S.Display();
                        Console.ReadLine(); Console.Clear(); break;
                    case 3: Console.Clear(); S.Search();
                        Console.ReadLine(); Console.Clear(); break;
                    case 4: return;
                    default: Console.WriteLine("Invalid Input."); break;}
            }
            Console.ReadLine();
        }
    }
}