Web-D - File
Web-D - File
image .
<!DOCTYPE html>
<html>
<head>
<style>
body {
.container {
width: 80%;
margin: 0 auto;
.content {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
.content p {
flex: 1;
.content img {
width: 400px;
height: auto;
margin-left: 20px;
</style>
</head>
<body>
<div class="container">
<h1>PROGRAM 1</h1>
<div class="content">
<p>
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Unde in,
tempore minus ratione quas hic neque possimus sed suscipit qui commodi
</p>
</div>
<div class="content">
<p>
</p>
</div>
<div class="content">
<p>
maiores!
</p>
</div>
</div>
</body>
</html>
OUTPUT :
PROGRAM 2: Write a program to create in HTML to create Student feedback form(use
textbox, textarea checkbox radio button select box etc)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<label for="name">Name:</label>
<label for="email">Email:</label>
<label for="subject">Subject:</label>
<option value="Mathematics">Mathematics</option>
<option value="Science">Science</option>
<option value="English">English</option>
<option value="History">History</option>
</select><br><br>
<label for="feedback">Feedback:</label><br>
<label for="excellent">Excellent</label><br>
<label for="good">Good</label><br>
<input type="radio" id="average" name="rating" value="average">
<label for="average">Average</label><br>
<label for="poor">Poor</label><br><br>
</form>
</body>
</html>
OUTPUT :
PROGRAM 3: Create your class timetable using table tag. Use External CSS to format it.
Index.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Class Timetable</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<h1>Class Timetable</h1>
<table>
<tr>
<th>Time</th>
<th>Monday</th>
<th>Tuesday</th>
<th>Wednesday</th>
<th>Thursday</th>
<th>Friday</th>
</tr>
<tr>
<td>8:00 - 9:00</td>
<td>Math</td>
<td>English</td>
<td>Science</td>
<td>History</td>
<td>Physical Education</td>
</tr>
<tr>
<td>9:00 - 10:00</td>
<td>Physics</td>
<td>Chemistry</td>
<td>Math</td>
<td>English</td>
<td>Science</td>
</tr>
<tr>
<td>10:00 - 11:00</td>
<td>History</td>
<td>Physical Education</td>
<td>Physics</td>
<td>Chemistry</td>
<td>Math</td>
</tr>
<!-- Add more rows for remaining hours -->
</table>
</body>
</html>
style.css:
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 20px;
}
h1 {
text-align: center;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
th, td {
border: 1px solid #dddddd;
padding: 8px;
text-align: center;
}
th {
background-color: #f2f2f2;
}
tr:nth-child(even) {
background-color: #ffffff;
}
tr:nth-child(odd) {
background-color: #f9f9f9;
}
OUTPUT :
PROGRAM 4: Create your resume using HTML tags and then use inline CSS for the
formatting.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>My Resume</title>
</head>
<body>
<li>Developed and maintained company website using HTML, CSS, and JavaScript.</li>
<li>Collaborated with the design team to create visually appealing user interfaces.</li>
</ul>
</div>
<div>
</div>
</div>
</body>
OUTPUT :
PROGRAM 5: Develop a Java Script to display today's date.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Display Today's Date</title>
</head>
<body>
<h1>Today's Date</h1>
<p id="date"></p>
<script>
// Get today's date
var today = new Date();
// Extract date, month, and year
var date = today.getDate();
var month = today.getMonth() + 1; // Month starts from 0, so add 1
var year = today.getFullYear();
// Format the date as "DD/MM/YYYY"
var formattedDate = (date < 10 ? '0' : '') + date + '/' + (month < 10 ? '0' : '') + month + '/' +
year;
// Display the date
document.getElementById('date').innerText = formattedDate;
</script>
</body>
</html>
OUTPUT :
PROGRAM 6: Develop simple calculator for addition, subtraction, multiplication and
division operation using JavaScript.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Simple Calculator</title>
</head>
<body>
<h1>Simple Calculator</h1>
<label for="num1">Enter number 1:</label>
<input type="number" id="num1"><br><br>
<label for="num2">Enter number 2:</label>
<input type="number" id="num2"><br><br>
<label for="operator">Select an operator:</label>
<select id="operator">
<option value="add">+</option>
<option value="subtract">-</option>
<option value="multiply">*</option>
<option value="divide">/</option>
</select><br><br>
<button onclick="calculate()">Calculate</button><br><br>
<p id="result"></p>
<script>
function calculate() {
// Get input values
var num1 = parseFloat(document.getElementById('num1').value);
var num2 = parseFloat(document.getElementById('num2').value);
var operator = document.getElementById('operator').value;
// Perform calculation based on selected operator
var result;
switch (operator) {
case 'add':
result = num1 + num2;
break;
case 'subtract':
result = num1 - num2;
break;
case 'multiply':
result = num1 * num2;
break;
case 'divide':
if (num2 !== 0) {
result=num1/num2;
}
else{
result=”cannot divide by zero!”;
}
break;
default:
result=”invalid operator”;
}
// Display result
document.getElementById('result').innerText = "Result: " + result;
}
</script>
</body>
</html>
OUTPUT :
PROGRAM 7: Write a JavaScript that calculates the squares and cubes of the numbers from 0 to 10
and outputs HTML text that displays the resulting values in an HTML table format.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Squares and Cubes</title>
</head>
<body>
<h1>Squares and Cubes</h1>
<div id="output"></div>
<script>
// Function to calculate squares and cubes
function calculateSquaresAndCubes() {
var result = "<table border='1'>";
result += "<tr><th>Number</th><th>Square</th><th>Cube</th></tr>";
// Calculate squares and cubes for numbers from 0 to 10
for (var i = 0; i <= 10; i++) {
var square = i * i;
var cube = i * i * i;
result += "<tr><td>" + i + "</td><td>" + square + "</td><td>" + cube + "</td></tr>";
}
result += "</table>";
// Display the result in the output div
document.getElementById('output').innerHTML = result;
}
// Call the function when the page loads
window.onload = function() {
calculateSquaresAndCubes();
};
</script>
</body>
</html>
OUTPUT :
PROGRAM 8: Write a JavaScript code that displays text "TEXT-GROWING" with increasing font size
in the interval of 100m sin RED COLOR, when the font size reaches 50pt it displays "TEXT
SHRINKING "in BLUE color. Then the font size decreases to 5pt.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Text Animation</title>
</head>
<body>
<p id="text" style="color: red; font-size: 10pt;">TEXT-GROWING</p>
<script>
var fontSize = 10;
var increasing = true;
var textElement = document.getElementById('text');
function animateText() {
if (increasing) {
fontSize += 1;
textElement.style.fontSize = fontSize + "pt";
if (fontSize >= 50) {
textElement.innerText = "TEXT SHRINKING";
textElement.style.color = "blue";
increasing = false;
}
} else {
fontSize -= 1;
textElement.style.fontSize = fontSize + "pt";
if (fontSize <= 5) {
clearInterval(intervalId);
}
}
}
var intervalId = setInterval(animateText, 100);
</script>
</body>
</html>
OUTPUT :
Practical 9: Develop an android application representing a simple calculator
Program :
activity_main.xml
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/linearLayout1"
android:layout_marginLeft="10pt"
android:layout_marginRight="10pt"
android:layout_marginTop="3pt">
<EditText android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_marginRight="5pt"
android:id="@+id/etNum1"
android:layout_width="match_parent"
android:inputType="numberDecimal">
</EditText><EditText
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginLeft="5pt"
android:id="@+id/etNum2"
android:layout_width="match_parent"
android:inputType="numberDecimal">
</EditText>
</LinearLayout><LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/linearLayout2"
android:layout_marginTop="3pt"
android:layout_marginLeft="5pt"
android:layout_marginRight="5pt">
android:layout_weight="1" android:text="+"
android:textSize="15pt"
android:id="@+id/btnAdd">
</Button><Button
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_weight="1" android:text="-"
android:textSize="15pt" android:id="@+id/btnSub">
</Button><Button
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_weight="1" android:text="*"
android:textSize="15pt" android:id="@+id/btnMult">
</Button><Button
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_weight="1" android:text="/"
android:textSize="15pt"
android:id="@+id/btnDiv"></Button>
</LinearLayout><TextView
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_marginLeft="5pt"
android:layout_marginRight="5pt"
android:textSize="12pt"
android:layout_marginTop="3pt"
android:id="@+id/tvResult"
android:gravity="center_horizontal">
</TextView>
</LinearLayout>
import android.app.Activity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import
android.view.View.OnClickListener;
android.widget.EditText; import
android.widget.TextView;
EditText input1;
EditText input2;
Button addition;
Button subtraction;
Button multiplication;
Button division;
TextView tvResult;
@Override
super.onCreate(savedInstanceState);
setContentView(R.layout.main); input1 =
(EditText) findViewById(R.id.etNum1); input2
= (EditText) findViewById(R.id.etNum2);
// set a listener
addition.setOnClickListener(this);
subtraction.setOnClickListener(this);
multiplication.setOnClickListener(this);
division.setOnClickListener(this);
@Override
float result = 0;
(TextUtils.isEmpty(input1.getText().toString())
|| TextUtils.isEmpty(input2.getText().toString())) {
return; }
num1 =
Float.parseFloat(input1.getText().toString());
num2 =
Float.parseFloat(input2.getText().toString());
// defines the button that has been clicked and performs the corresponding operation
= num1 + num2;
break; case
R.id.btnSub:
= num1 - num2;
break; case
R.id.btnMult:
= num1 * num2;
break; case
R.id.btnDiv:
= num1 / num2;
break;
default:
break;
tvResult.setText(num1 + " " + oper + " " + num2 + " = " + result);
}
OUTPUT :
Practical 10: Develop an android application for working with notification
ALGORITHM:
• In the window that appears, open the Android folder, select Android Application Project,
• Provide the application name and the project name and then finally give the desired
package name.
• Choose a launcher icon for your application and then select Blank Activity and then click
Next
• Provide the desired Activity name for your project and then click Finish.
• Fill in the details for the AVD. Give it a name, a platform target, an SD card size, and
• Click Create AVD and Select the new AVD from the Android Virtual Device
6. Type the Activity Name as Second Activity and click Finish button.
PROGRAM CODE:
MainActivity.java
package com.example.admin.myapplication;
importandroid.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
27
import android.widget.EditText;
Button notify;
EditTexte;
@Override
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
e= (EditText) findViewById(R.id.editText);
notify.setOnClickListener(new View.OnClickListener()
@Override
Message").setContentText(e.getText().toString()).setSmallIcon(R.mipmap.ic_launcher).setContentI
ntent(pending).build();
getSystemService(NOTIFICATION_SERVICE);
noti.flags|= Notification.FLAG_AUTO_CANCEL;
manager.notify(0, noti);
});
activity_main.xml
<LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="30sp" />
<EditText
android:id="@+id/editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="30sp" />
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="30dp"
android:layout_gravity="center"
android:text="Notify"
android:textSize="30sp"/>
</LinearLayout
>
Main2Activity.java
package com.example.admin.myapplication;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
@Override
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
OUTPUT:
Result:
Thus Android Application that that makes use of Notification Manager is developed
and executedsuccessfully.
Practical 11: Develop an android application for connecting to internet and sending e-mail.
ALGORITHM:
• In the window that appears, open the Android folder, select Android Application Project,
• Provide the application name and the project name and then finally give the desired
package name.
• Choose a launcher icon for your application and then select Blank Activity and then click
Next
• Provide the desired Activity name for your project and then click Finish.
• Fill in the details for the AVD. Give it a name, a platform target, an SD card size, and
• Click Create AVD and Select the new AVD from the Android Virtual Device
PROGRAM CODE:
MainActivity.java
package com.example.admin.myapplication;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
@Override
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
startBtn.setOnClickListener(new View.OnClickListener() {
sendEmail();
});
String[] TO = {
};
String[] CC = {
};
emailIntent.setData(Uri.parse("mailto:"));
emailIntent.setType("text/plain");
emailIntent.putExtra(Intent.EXTRA_EMAIL, TO);
emailIntent.putExtra(Intent.EXTRA_CC, CC);
try {
startActivity(Intent.createChooser(emailIntent, "Send mail..."));
finish();
Toast.LENGTH_SHORT).show();
activity_main.xml
<RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.admin.myapplication.MainActivity">
<EditTextandroid:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:ems="10"
android:id="@+id/editText"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:ems="10"
android:id="@+id/editText2"
android:layout_below="@+id/editText"
android:layout_alignRight="@+id/editText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:ems="10"
android:id="@+id/editText3"
android:layout_below="@+id/editText2"
android:layout_alignRight="@+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SEND MAIL"
android:id="@+id/sendbttn"
android:layout_centerVertical="true"
android:layout_alignLeft="@+id/editText3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Recipient"
android:id="@+id/textView"
android:layout_alignBottom="@+id/editText"
android:layout_alignParentLeft="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="subject"
android:id="@+id/textView2"
android:layout_alignBottom="@+id/editText2"
android:layout_alignParentLeft="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Message Body"
android:id="@+id/textView3"
android:layout_alignBottom="@+id/editText3"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</RelativeLayout
>
OUTPUT:
RESULT:
Thus, the program for android application to send an email was executed successfully
PRACTICAL 12 : Develop an android application for working with device camera
Program:
Activity-xml.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<Button
android:id="@+id/camera_button"
android:layout_width="100dp"
android:layout_height="50dp"
android:layout_marginStart="150dp"
android:text="Camera" />
<ImageView
android:id="@+id/click_image"
android:layout_width="350dp"
android:layout_height="450dp"
android:layout_marginStart="30dp"
android:layout_marginTop="70dp"
android:layout_marginBottom="10dp" />
</RelativeLayout>
MainActivity.java
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.provider.MediaStore;
import android.widget.Button;
import android.widget.ImageView;
import androidx.appcompat.app.AppCompatActivity;
Button camera_open_id;
ImageView click_image_id;
@Override
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// By ID we can get each component which id is assigned in XML file get Buttons and imageview.
camera_open_id = findViewById(R.id.camera_button);
click_image_id = findViewById(R.id.click_image);
camera_open_id.setOnClickListener(v -> {
// Create the camera_intent ACTION_IMAGE_CAPTURE it will open the camera for capture the image
startActivityForResult(camera_intent, pic_id);
});
if (requestCode == pic_id) {
// BitMap is data structure of image file which store the image in memory
click_image_id.setImageBitmap(photo);
}}}