Likes

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();}
}
}
}

No comments: