Emails8.txt
<!DOCTYPE html>
<html>
<head>
<title>Email Validation</title>
</head>
<body>
<h1>Email Validation</h1>
<label for="email">Enter Your Email:</label>
<input type="text" id="email" placeholder="abc@xyz.com">
<button onclick="validateEmail()">Submit</button>
<p id="result"></p>
<script>
function validateEmail() {
const emailInput = document.getElementById("email");
const result = document.getElementById("result");
const email = emailInput.value;
if (email.includes("@") && email.includes(".")) {
result.textContent = "Valid email: " + email;
result.style.color = "green";
} else {
alert("Your Email is Invalid! It must contain '@' and '.' Please re-enter your email.");
emailInput.value = "";
emailInput.focus();
result.textContent = "";
}
}
</script>
</body>
</html>
Website7.txt
<!DOCTYPE html>
<head>
<title>Simple Website</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f2f2f2;
text-align: center;
margin: 0;
padding: 0;
}
header {
background-color: #0078d7;
color: white;
padding: 15px;
}
nav a {
color: white;
margin: 0 10px;
text-decoration: none;
}
button {
padding: 10px 20px;
margin-top: 10px;
cursor: pointer;
background-color: #0078d7;
color: white;
border: none;
border-radius: 5px;
}
button:hover {
background-color: #005fa3;
}
footer {
margin-top: 20px;
padding: 10px;
background: #ddd;
}
</style>
</head>
<body>
<header>
<h1>!!! Welcome_to_My_Simple_Website !!!</h1>
<nav>
<a href=".">HOME</a>
<a href=".">ABOUT</a>
<a href=".">MORE</a>
</nav>
</header>
<main>
<h2>MY_WEBSITE</h2>
<p>THIS_IS_MY_FIRST_WEBSITE</p>
<button onclick="changeMessage()">WEB</button>
<p id="msg"></p>
</main>
<footer>
<p>EMAIL:- rajm2024@gmail.com MOB:- +91 98556XXXXX </p>
</footer>
<script>
function changeMessage() {
document.getElementById("msg").innerHTML = "!!! THANK_YOU !!!";
}
</script>
</body>
</html>
Exception4.txt
class Except
{
public static void main(String args[])
{
int a=10;
int b=5;
int c=5;
int x,y;
try
{
x=a/(b-c);
}
catch(ArithmeticException e)
{
System.out.println("Division By Zero");
}
y=a/(b+c);
System.out.println(y);
}
}
2)
class Ex
{
public static void main(String args[])
{
int a[]={5,10};
int b=5;
int x,y;
try
{
x=a[2]/(b-a[1]);
}
catch(ArithmeticException e)
{
System.out.println("Division By Zero");
}
catch(ArrayIndexOutOfBoundsException e)
{
System.out.println("Array Index Error.");
}
y=a[1]/a[0];
System.out.println(y);
}
}
React10.txt
import React, { useState } from "react";
function ColorSelector() {
// Declare a state variable called selectedColor
const [selectedColor, setSelectedColor] = useState("");
// Function to handle button clicks
const handleColorClick = (color) => {
setSelectedColor(color);
};
return (
<div style={{ textAlign: "center", marginTop: "50px" }}>
<h2>Select a Color</h2>
<div style={{ margin: "20px" }}>
<button
onClick={() => handleColorClick("Red")}
style={{ backgroundColor: "red", color: "white", margin: "5px", padding: "10px 20px" }}
>
Red
</button>
<button
onClick={() => handleColorClick("Blue")}
style={{ backgroundColor: "blue", color: "white", margin: "5px", padding: "10px 20px" }}
>
Blue
</button>
<button
onClick={() => handleColorClick("Green")}
style={{ backgroundColor: "green", color: "white", margin: "5px", padding: "10px 20px" }}
>
Green
</button>
<button
onClick={() => handleColorClick("Yellow")}
style={{ backgroundColor: "yellow", color: "black", margin: "5px", padding: "10px 20px" }}
>
Yellow
</button>
</div>
{selectedColor && (
<h3>You have selected {selectedColor} color!
</h3>
)}
</div>
);
}
export default ColorSelector;
Bank1.txt
class Bank
{
String h_name,acc_type;
int acc_no,bal;
void init(String x,String p,int y,int z)
{
h_name=x;
acc_type=p;
acc_no=y;
bal=z;
}
void deposite(int x)
{
int amt=x;
bal=bal+amt;
System.out.println("Available Balance is_"+bal);
}
void with(int amt)
{
if(bal<amt)
{
System.out.println("Sufficient Balance");
}
else
{
bal=bal-amt;
System.out.println(amt+"_Withdrawed");
}
}
void display()
{
System.out.println("Customer Name="+h_name);
System.out.println("Account Type="+acc_type);
System.out.println("Available Balance="+bal);
}
public static void main(String args[])
{
Bank b=new Bank();
b.init("ABC","Saving",12345,10000);
b.deposite(1000);
b.with(1000);
b.display();
}
}
Inheritance3.txt
1)
class Add
{
int add=100;
void display_Add()
{
System.out.println("Additon is="+add);
}
}
class Sub extends Add
{
int sub=200;
void display_Sub()
{
System.out.println("Substraction is="+sub);
}
}
class Single
{
public static void main(String args[])
{
Sub s=new Sub();
s.display_Add();
s.display_Sub();
}
}
2)
class Add
{
int add=500;
void display_Add()
{
System.out.println("Addition is="+add);
}
}
class Sub extends Add
{
int sub=100;
void display_Sub()
{
System.out.println("Substraction is="+sub);
}
}
class Mul extends Sub
{
int mul=100;
void display_Mul()
{
System.out.println("Multiplication is="+mul);
}
}
class Multilevel
{
public static void main(String args[])
{
Mul m=new Mul();
m.display_Add();
m.display_Sub();
m.display_Mul();
}
}
3)
class Vehicle
{
void display(int a,int b)
{
System.out.println("Number Of Wheels:"+a);
System.out.println("Speed Of Vehicle is:"+b+"kmph");
}
}
class Car extends Vehicle
{
void pass(int x)
{
System.out.println("Number Of Passangers:"+x);
}
}
class Truck extends Vehicle
{
void load(int y)
{
System.out.println("Load Limit is:"+y+"tons");
}
}
class Heirarchical
{
public static void main(String args[])
{
Car c=new Car();
c.display(4,140);
c.pass(4);
Truck t=new Truck();
t.load(5);
t.display(8,80);
}
}
4)
interface Vehicle
{
void start();
void stop();
}
class Car implements Vehicle
{
public void start()
{
System.out.println("Car Started!!");
}
public void stop()
{
System.out.println("Car Stopped!!");
}
}
class Interface
{
public static void main(String args[])
{
Car c=new Car();
c.start();
c.stop();
}
}
Color9.txt
<!DOCTYPE html>
<html>
<head>
<title>Background Color Changer</title>
<style>
body {
text-align: center;
font-family: Arial ;
transition: background-color 1s ease;
}
h1 {
margin-top: 20%;
}
</style>
</head>
<body>
<h1>!!! BG COLOR CHANGE IN 5 SECONDS !!!</h1>
<script>
const colors = ["RED", "BLUE", "PURPLE", "RED", "SKYBLUE", "LIGHTGREEN"];
let index = 0;
function changeBackground() {
document.body.style.backgroundColor = colors[index];
index = (index + 1) % colors.length;
}
setInterval(changeBackground, 5000);
changeBackground();
</script>
</body>
</html>
Constr2.txt
class Room
{
int l,b;
Room(int x,int y)
{
l=x;
b=y;
}
Room(int x)
{
l=b=x;
}
int area()
{
return l*b;
}
public static void main(String args[])
{
Room r1=new Room(10,30);
Room r2=new Room(10);
int a1=r1.area();
int a2=r2.area();
System.out.println("area="+a1);
System.out.println("area="+a2);
}
}
class Calculator
{
public int sum(int a,int b)
{
return a+b;
}
public int sum(int a,int b,int c)
{
return a+b+c;
}
public double sum(double a,double b)
{
return a+b;
}
}
public class Main
{
public static void main(String args[])
{
Calculator calc=new Calculator();
System.out.println("Sum of 10 and 20:"+calc.sum(10,20));
System.out.println("Sum of 10,20 and 30:"+calc.sum(10,20,30));
System.out.println("Sum of 10.5 and 20.5:"+calc.sum(10.5,20.5));
}
}