O LEVEL (O-PR) – BATCH: S3
1 Create a document in Word. Format the document with various fonts (minimum 12, maximum
15) and margins (minimum 2, maximum 4). The document should include:
a) A bulleted or numbered list
b) A table containing name, address, basic pay, department as column heading
c) A picture of an animal using the clip art gallery
d) A header with your name and the date
e) A footer with pagination
2 Create a HTML page to accept the name, address, city, state, pin code. Add a send button to
send an email with the details of name and complete address.
<!DOCTYPE html>
<html>
<head>
<title>Send Address via Email</title>
</head>
<body>
<h1>Enter Your Details</h1>
<form action="mailto:example@example.com" method="POST" enctype="text/plain">
<label for="name">Name:</label><br>
<input type="text" id="name" name="name" required><br><br>
<label for="address">Address:</label><br>
<textarea id="address" name="address" rows="4" required></textarea><br><br>
<label for="city">City:</label><br>
<input type="text" id="city" name="city" required><br><br>
<label for="state">State:</label><br>
<input type="text" id="state" name="state" required><br><br>
<label for="pin">Pin Code:</label><br>
<input type="text" id="pin" name="pin" required><br><br>
<button type="submit">Send</button>
</form>
</body>
</html>
3. Write a program in ‘java script’ to input name, address and telephone number of ‘n’ persons (n<=20). Sort the record according to the name as a primary key and address as the secondary key. Print the sorted telephone directory.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Telephone Directory</title>
</head>
<body>
<h2>Telephone Directory</h2>
<button onclick="inputAndSort()">Enter Directory</button>
<pre id="output"></pre>
<script>
function sortDirectory(directory) {
return directory.sort((a, b) => {
if (a.name !== b.name) {
return a.name.localeCompare(b.name); // Sort by name
}
return a.address.localeCompare(b.address); // Sort by address if names are the same
});
}
function inputAndSort() {
const n = parseInt(prompt("Enter the number of persons (<= 20):"));
if (n > 20) {
alert("Number of persons should be 20 or less.");
return;
}
const directory = [];
for (let i = 0; i < n; i++) {
const name = prompt(`Enter name of person ${i + 1}:`);
const address = prompt(`Enter address of person ${i + 1}:`);
const telephone = prompt(`Enter telephone number of person ${i + 1}:`);
directory.push({ name, address, telephone });
}
// Sort the directory
const sortedDirectory = sortDirectory(directory);
// Display the sorted directory
let output = "Sorted Telephone Directory:\n";
sortedDirectory.forEach(entry => {
output += `Name: ${entry.name}, Address: ${entry.address}, Telephone: ${entry.telephone}\n`;
});
document.getElementById("output").textContent = output;
}
</script>
</body>
</html>