Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Step 1: Open any text editor (such as Notepad) and create a file named empdata.t

ID: 3835384 • Letter: S

Question

Step 1: Open any text editor (such as Notepad) and create a file named empdata.txt. Have the following information (Full Name, Age, Gender, Marital Status) about a person inside the file ONE UNDER THE OTHER [DO NOT HAVE TITLES IN THE FILE, ONLY THE DATA] Save the file.

Here is an example, how the data in the file look like.

Paul Hendrickson

35

Male

Single

Step 2: Write a Perl script to:

a. Open the above file

b. Read the lines from the file and print them on the screen with a title added. Close the file.

So when you run the script you should display the data as follows.

Full Name: Paul Hendrickson

Age: 35

Gender: Male

Marital Status: Single

Note: Nicely align the output as shown above.

Step 3: Add more code to change 2 of the items (Age and Marital Status). Script then continues and asks the question:

Do you want to change the age (Y/y or N/n): Y

User enters ‘Y’.

Script then asks the question: What is the new age? 37

User enters 37.

Then the script asks Do you want to change the Marital Status (Y/y or N/n): Y

User enters ‘Y’.

Script then asks the question: What is the new marital status? Married

User Enters Married.

Then the script opens the same file empdata.txt. Rewrites the updated information back to the file. Note: If The user enters ‘N’ in any of the two questions above, no change happens to the existing data item pertaining to each question.

Step 4: Open the same file again in a text editor such as Notepad. You should now see the result like this:

Paul Hendrickson

37

Male

Married

Here is a complete run:

Full Name: Paul Hendrickson

Age: 35

Gender: Male

Marital Status: Single

Do you want to change the age (Y/y or N/n): Y

What is the new age? 37

Do you want to change the Marital Status (Y/y or N/n): Y

What is the new marital status? Married

**Opened the file in Notepad. The result is:

Paul Hendrickson

37

Male

Married

Explanation / Answer

ANSWER::

<html xmlns="http://www.w3.org/1999/xhtml">

  <head>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>Very simple login using Perl, jQuery, Ajax, JSON and MySQL</title>

    <link rel="stylesheet" type="text/css" media="screen, projection"

      href="http://www.blueprintcss.org/blueprint/screen.css" />

    <link rel="stylesheet" type="text/css" media="screen, projection"

      href="http://www.blueprintcss.org/blueprint/plugins/buttons/screen.css" />

    <link rel="stylesheet" type="text/css" media="print"

      href="http://www.blueprintcss.org/blueprint/print.css" />

    <!--[if IE]><link rel="stylesheet" type="text/css" media="screen, projection"

      href="http://www.blueprintcss.org/blueprint/ie.css"><![endif]-->

    <script type="text/javascript"

      src="//code.jquery.com/jquery-1.4.4.min.js"></script>

    <script type="text/javascript" src="login.js"></script>

    <style type="text/css">

      #loginContent { width: 350px; margin: 100px auto; }

      button[type] { margin: 0.5em 0; }

    </style>

  </head>

  <body>

    <div id="loginContent" class="container">

      <div id="loginResult">

      </div>

      <form id="loginForm" name="loginForm" method="post" action="">

        <fieldset>

          <legend>Enter information</legend>

          <p>

            <label for="username">Username</label>

            <br />

            <input type="text" id="username" name="username" class="text" size="20" />

          </p>

          <p>

            <label for="password">Password</label>

            <br />

            <input type="password" id="password" name="password" class="text" size="20" />

          </p>

          <p>

            <button type="submit" class="button positive">

             <img alt="ok" src=

             "http://www.blueprintcss.org/blueprint/plugins/buttons/icons/tick.png" />

             Login

            </button>

          </p>

        </fieldset>

      </form>

    </div>

  </body>

</html>

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote