EX - NO:1 Book Details: To Create A Book Details For Various Books, Author, Year, and Price Using XML and Desingning To Css

Download as pdf or txt
Download as pdf or txt
You are on page 1of 49

EX.

NO:1

BOOK DETAILS

AIM:

To create a book details for various books,author,year,and price using xml and
desingning to css.

ALGORITHM:

STEP1:Start the program.

STEP2:Open notepad and start to type the program.

STEP 3 :To write a XML code for various books,authors,year and price.

STEP 4 : Write the CSS Code to designing in a various xml attributes.

STEP 5 : to save the xml document in the book.xml and CSS file is save in Rule.css.

STEP6:To run the xml Source code in any browsers.

STEP 6 : Display the results in Screen

STEP 7 : Stop the program.


EX.NO:1 BOOK DETAILS

BOOK.XML
<?xml version="1.0" encoding="UTF-8"?>

<?xml-stylesheet type="text/css" href="rule.css"?>

<books>

<head>Welcome to Dilipkumar's Book World!</head>

<book>

<title>Wings of fire</title>

<author>A.P.J Abdul kalam</author>

<year>2019</year>

<price>330</price>

</book>

<book>

<title>Quantantative Aptitude</title>

<author>R.S Agarwal</author>

<year>2018</year>

<price>600</price>

</book>

<book>

<title>The world inside the window</title>

<author>Gandiji</author>

<year>1934</year>

<price>580</price>

</book>

<book>

<title>mahabaratham</title>

<author>Viliputurar</author>
<year>1567</year>

<price>750</price>

</book>

<book>

<title>Ramayana</title>

<author>Vanmeegi</author>

<year>1276</year>

<price>300</price>

</book>

</books>

RULE.CSS
books

color:white;

width:100%;

background-color:powderblue;

head

text-align:center;

color:darkblue;

font-size:40px;

background-color:orange;

head,title,author,year,price

display:block;
}

title

text-align:center;

font-size:30px;

font-weight:bold;

color:green;

author,year,price

color:brown;

font-size:25px;

text-align:center;

}
OUTPUT:-
EX.NO:2

PRODUCT DETAILS

AIM:

To create a product details for various products and its name,price,quantity,

Stock listin xml source code and designing to css code.

ALGORITHM:

STEP1:Start the program.

STEP2:Open notepad and start to type the program.

STEP3:To write a XML code for various products like pen,pencil,milk and its

price,quantity,stock and others.

STEP 4 : Write the CSS Code to designing in a various xml attributes.

STEP 5 : to save the xml document in the prg2.xml and CSS file is save in products.css.

STEP6:To run the xml Source code in any browsers.

STEP7 :Display the results in Screen

STEP8: Stop the program.


EX.NO:2 PRODUCT DETAILS

Prg2.xml
<?xml version="1.0" encoding="UTF-8"?>

<?xml-stylesheet type="text/css" href="products.css"?>

<products>

<product id="p1" class="special">

<name>Milk</name>

<price>80</price>

<stock>4 Litre</stock>

<country>Denmark</country>

</product>

<product id="p2" class="cs">

<name>Saree</name>

<price>10000</price>

<stock>5</stock>

<country>India</country>

</product>

<product id="p3" class="it">

<name>Pen</name>

<price>100</price>

<stock>20</stock>

<country>Jordan</country>

</product>

<product id="p4" class="bca">

<name>Fan</name>

<price>1500</price>

<stock>5</stock>
<country>Australia</country>

</product>

<product id="p5" class="special">

<name>Fridge</name>

<price>1225</price>

<stock>3</stock>

<country>America</country>

</product>

</products>

Products.css
products

font-size:100%;

margin:0.5em;

font-family: Verdana;

display:block

product

display:block;

border: 1px solid silver;

margin:0.5em;

padding:0.5em;

background-color:whitesmoke;

name, price, stock, country


{

display:block

name

color:red;

text-decoration: underline;

price

color:green

stock

color:brown

country

color:blue

product#p4 {text-align:center}

product[class=special] {background-color:green}

product[class=bca] {background-color:orange}

product[class=cs] {background-color:Gold}

product[class=it] {background-color:powderblue}
OUTPUT:-
EX.NO:3

OCEANS DETAILS

AIM:

To create a Oceans details for various Oceans in the world and area and depth
of the Oceans in xml source code and designing to css source code.

ALGORITHM:

STEP1:Start the program.

STEP2:Open notepad and start to type the program.

STEP3:To write a XML code for various Biggest Oceans name,area of the ocean and its
depth.

STEP 4 : Write the CSS Code to designing in a various xml attributes.

STEP 5 : to save the xml document in the prg3.xml and CSS file is save in Oceans.css.

STEP6:To run the xml Source code in any browsers.

STEP7 :Display the results in Screen

STEP8: Stop the program.


EX.NO:3 OCEANS DETAILS

Prg3.xml
<?xml version="1.0"?>

<?xml-stylesheet type="text/css" href="oceans.css"?>

<!DOCTYPE planet>

<planet>

<ocean>

<name>Arctic</name>

<area>13,000</area>

<depth>1,200</depth>

</ocean>

<ocean>

<name>Atlantic</name>

<area>87,000</area>

<depth>3,900</depth>

</ocean>

<ocean>

<name>Pacific</name>

<area>180,000</area>

<depth>4,000</depth>

</ocean>

<ocean>

<name>Indian</name>

<area>75,000</area>

<depth>3,900</depth>

</ocean>

<ocean>
<name>Southern</name>

<area>20,000</area>

<depth>4,500</depth>

</ocean>

</planet>

Oceans.css
planet:before

display: block;

width: 8em;

font-weight: bold;

font-size: 100%;

content: "Oceans";

margin: -.75em 0px .25em -.25em;

padding: .1em .25em;

background-color: #cdf;

planet

display: block;

margin: 2em 1em;

border: 4px solid #cdf;

padding: 0px 1em;

background-color: white;

ocean

{
display: block;

margin-bottom: 1em;

name

display: block;

font-weight: bold;

font-size: 150%;

area

display: block;

area:before

content: "Area: ";

area:after

content: " million km\B2";

depth

display: block;

depth:before

{
content: "Mean depth: ";

depth:after

content: " m";

OUTPUT:-
EX.NO:4

PAITENT DETAILS

AIM:

To create a product details for various paitents and his name,age,room


no,medical problem and his insurance type and design with xsl source code.

ALGORITHM:

STEP1:Start the program.

STEP2:Open notepad and start to type the program.

STEP3:To write a XML code for various paitents and his name,age,

room no,medical problem and his insurance type.

STEP 4 : Write the XSL Code to designing in a various xml attributes.

STEP 5 : to save the XSL document in the prg4.xml and CSS file is save in paitent.xsl

STEP6:To run the xml Source code in any browsers.

STEP7 :Display the results in Screen

STEP8: Stop the program.


EX.NO:4 PAITENT DETAILS

Prg4.xml
<?xml version="1.0" encoding="utf-8"?>

<?xml-stylesheet type="text/xsl" href="paitent.xsl"?>

<patients>

<patient>

<name>

<fname> sanjay </fname>

<mname> s</mname>

<lname> Srinivas</lname>

</name>

<ssn> 100 </ssn>

<age> 80</age>

<roomnumber> 420 </roomnumber>

<insurance type="Primary">

<id> 10 </id>

<address> Yeshwanthpura</address>

</insurance>

<insurance type="Secondary">

<id>20 </id>

<address> jayanagar </address>

</insurance>

<medproblems> Bp </medproblems>

<drugallergy>None</drugallergy>

</patient>

<patient>

<name>
<fname> rakshith </fname>

<mname> gm</mname>

<lname> gowda</lname>

</name>

<ssn> 101 </ssn>

<age> 41</age>

<roomnumber> 421 </roomnumber>

<insurance type="Primary">

<id> 111</id>

<address> jp nagar

</address>

</insurance>

<insurance type="Secondary">

<id>112 </id>

<address> vijayanagar </address>

</insurance>

<medproblems> vitamin deficiency </medproblems>

<drugallergy>Cold</drugallergy>

</patient>

<patient>

<name>

<fname> rudresh </fname>

<mname> g</mname>

<lname> gowda </lname>

</name>

<ssn> 102 </ssn>

<age> 42</age>
<roomnumber> 422 </roomnumber>

<insurance type="Primary">

<id> 113 </id>

<address> mathikere </address>

</insurance>

<insurance type="Secondary">

<id> 114</id>

<address> jp</address>

</insurance>

<medproblems>cancer </medproblems>

<drugallergy>Swelling</drugallergy>

</patient>

<patient>

<name>

<fname> kumar </fname>

<mname> v</mname>

<lname>gowda</lname>

</name>

<ssn> 103</ssn>

<age> 41</age>

<roomnumber> 423 </roomnumber>

<insurance type="Primary">

<id> 113 </id>

<address> malleshwaram. </address>

</insurance>

<insurance type="Secondary">

<id> 115</id>
<address> j.p.v nagar</address>

</insurance>

<medproblems> coma </medproblems>

<drugallergy>None</drugallergy>

</patient>

</patients>

paitent.xsl
<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">

<html>

<body>

<h2> Patient Information </h2>

<table border="2">

<tr bgcolor="orange">

<th> SSN </th>

<th> Name </th>

<th> Age </th>

<th> Room </th>

<th>Primary insurance Company</th>

<th>secondary insurance Company</th>

<th>Medical problem</th>

<th>Drug Allery</th>

</tr>

<xsl:for-each select="patients/patient">

<tr>
<td> <xsl:value-of select="ssn"/> </td>

<td> <xsl:value-of select="name/fname"/> </td>

<td> <xsl:value-of select="age"/> </td>

<td> <xsl:value-of select="roomnumber"/> </td>

<td><xsl:value-of select="insurance[1]/address"/> </td>

<td><xsl:value-of select="insurance[2]/address"/> </td>

<td> <xsl:value-of select="medproblems"/> </td>

<td> <xsl:value-of select="drugallergy"/> </td>

</tr>

</xsl:for-each>

</table>

</body>

</html>

</xsl:template>

</xsl:stylesheet>
OUTPUT:-
EX.NO:5

STUDENT DETAILS

AIM:

To create a Xml DTD codes to write a full details of a student information and
designing with HTML Source code.

ALGORITHM:

STEP1:Start the program.

STEP2:Open notepad and start to type the program.

STEP3:To write a XML code for a student name,address,college and department

STEP 4 : Write the XML DTD Code a various xml elements.

STEP 5 : to save the XML document in the Student.xml and DTD file is save in
Student.dtd and to save a html source code for Student.html.

STEP6:To run the html Source code in any browsers.

STEP7 :Display the results in Screen.

STEP8: Stop the program.


EX.NO:5 STUDENT DETAILS

Student.xml
<?xml version="1.0"?>

<!DOCTYPE STUDENTS SYSTEM "STUDENT.dtd">

<STUDENTS>

<STUDENT>

<STUDENTDATA>

<NAME> DILIPUMAR P</NAME>

<ID> 17USC004 </ID>

<AGE> 20 </AGE>

<ADDRESS>37,RAJA LAKSHMI GARDEN,ATHIPLAYAM</ADDRESS>

</STUDENTDATA>

</STUDENT>

</STUDENTS>

Stuent.dtd
<?xml version="1.0"?>

<!ELEMENT STUDENTS (STUDENT*)>

<!ELEMENT STUDENT (STUDENTDATA*)>

<!ELEMENT STUDENTDATA (NAME,ID,AGE,ADDRESS)>

<!ELEMENT NAME (#PCDATA)>

<!ELEMENT ID (#PCDATA)>

<!ELEMENT AGE (#PCDATA)>

<!ELEMENT ADDRESS (#PCDATA)>


Student.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"E:\XML1\STUDENT.dtd"">

<html>

<head COLOR:RED><h1 style="color:red">

<MARQUEE DIRECTION="RIGHT"><CENTER> COLLEGE OF ARTS AND SCIENCE


</CENTER> </MARQUEE> </H1>

<title> STUDENT DETAILS DISPLAY </title>

</head>

<body style="background-color:PINK"> <H2 STYLE="COLOR: BLUE">


<MARQUEE><CENTER>DEPARTMENT OF COMPUTER SCIENCE</CENTER>
</MARQUEE><BR></H2>

<MARQUEE DIRECTION="DOWN"><H3 STYLE=


"COLOR:GREEN"><CENTER>FINAL CS STUDENTS DETAILS
</CENTER></MARQUEE><BR><BR></H3>

<CENTER><TABLE BORDER="1">

<THEAD>

<TR>

<TH> NAME </TH>

<TH> ID </TH>

<TH> AGE </TH>

<TH> ADDRESS </TH>

</TR>

</THEAD>

<TFOOT>

<TR>

<TH COLSPAN="4"> STUDENT CATALOG</TH>

</TFOOT>

<TR>
<TD>DILPKUMAR P</TD>

<TD>17USC004</TD>

<TD>20</TD>

<TD>37,RAJA LAKSHMI GARDEN,ATHIPLAYAM</TD>

</TR>

</TABLE></CENTER>

</body>

</html>
OUTPUT:-

EX.NO:6
ELECTRICITY BILL CALCULATION

AIM:

Write a PHP program to create Electricity Bill Calculation

ALGORITHM:

STEP 1 : Start the program.

STEP 2 : Open notepad and start to type the program.

STEP 3 : Design the input form using HTML and CSS and get

name,number,address,mno,month,pmr,cmr as input from the user.

STEP 4 : Write the PHP Code to calculate Units.

STEP 5 :Use if statement to calculate Rate and Amount .

STEP 6 : Display the results in Screen.

STEP 7 : Stop the program.

EX.NO:6 ELECTRICITY BILL CALCULATION


Ebill.html
<html>

<head>

<center><title>Elelctricity bill</title>

</center>

</head>

<body>

<form action="bill.php" method="POST">

Enter Consumer Number:

<input type="text" name="cnum"></br></br>

Enter Consumer Name:&nbsp&nbsp&nbsp&nbsp

<input type="text" name="cname"></br></br>

Enter month:&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp

<input type="text" name="month"><br></br>

Enter current month Reading:

<input type="text" name="cmr"><br></br>

Enter previous month Reading:

<input type="text" name="pmr"><br></br>

<input type="submit" value="calculate bill">

</form>

</body>

</html>

Bill.php
<?php

$consnum=$_POST["cnum"];

$consname=$_POST["cname"];

$month1=$_POST["month"];

$cmr1=$_POST["cmr"];

$pmr1=$_POST["pmr"];

$units=$cmr1-$pmr1;

if($units>0and $units<=100)

$up=3;

else if($units>101 and $units<=300)

$up=5;

else if ($units>300 and $units<=500)

$up=6;

else if($units>500 and $units<=1000)

$up=9;

else if($units>1000)

$up=15;

$amount=$units*$up;

echo "electricity</br>";

echo "consumer number:$consnum<br>";

echo "consumer name:$consname<br>";

echo "month:$month1<br>";

echo "current month:$cmr1<br>";

echo "previous month:$pmr1<br>";

echo "units:$units<br>";

echo "amount:$amount<br>"; ?

OUTPUT:-
EX.NO:7
FACTORIAL USING RECURSIVE FUNCTIONS

AIM:

Write a PHP program to create factorial value using Recursive Functions

ALGORITHM:

STEP 1 : Start the program.

STEP 2 : Open notepad and start to type the program.

STEP 3 : Design the input form using HTML and CSS and get the number

from user

STEP 4 : Write the PHP Code to find the factorial number using if statement

STEP 5 : Display the factorial of a given number

STEP 6 : If the given number is 0 return the value 1.

STEP 7 : Stop the program.

EX.NO:7 FACTORIAL USING RECURSIVE FUNCTIONS


Fact.html
<html>

<body>

<H1>

<CENTER>FACTORIAL VALUE</CENTER>

</H1></BR>

<form action="fact.php" method="post">

Enter a number:

<input type="text" name="number" required>

</br>

<BR>

<input type="submit" value="factorial value">

</form>

</body>

</html>

Fact.php
<html>

<body>

<center><b>FACTORIAL NUMBER:</b><center>

<?php

echo fact($_POST["number"]);

function fact($n)

if($n==0)

return 1;
}

else

return $n*fact($n-1);

?>

</body>

</html>

OUTPUT:-
EX.NO:8
STUDENT MARKSHEET CREATION

AIM:

Write a PHP program to create Student Marksheet

ALGORITHM:

STEP 1 : Start the program.

STEP 2 : Open notepad and start to type the program.

STEP 3 : Design the input form using HTML and CSS and get student name,

marks as input

STEP 4 : Write the PHP Code to display the student name with marks and also

Calculate the total and average

STEP 5 : Using if statement for the student is pass or not

STEP 6 :Display the results in Screen

STEP 7 : Stop the program.

EX.NO:8 STUDENT MARKSHEET CREATION


Marksheet.html
<html>

<body>

<center>

<h1>STUDENT MARKSHEET</h1>

</center>

<BR>

<BR>

<BR>

<form action="marksheet.php" method="post">

<center>

ENTER MY NAME:

<input type="text" name="name"></br></BR>

ENTER SUBJECT1 MARK:

<input type="text" name="s1"></br></BR>

ENTER SUBJECT2 MARK:

<input type="text" name="s2"></br></BR>

ENTER SUBJECT3 MARK:

<input type="text" name="s3"></br></BR>

ENTER SUBJECT4 MARK:

<input type="text" name="s4"></br></BR>

ENTER SUBJECT5 MARK:

<input type="text" name="s5"></br></BR>

<BR><BR>

<input type="submit" name="submit" value="MY MARKS">

</center>

</form>
</body>

</html>

marksheet.php
<HTML>

<BODY>

<CENTER>

<H1>MY UG MARKSHEET</H1>

<br>

<?php

$n=$_POST["name"];

$s1=$_POST["s1"];

$s2=$_POST["s2"];

$s3=$_POST["s3"];

$s4=$_POST["s4"];

$s5=$_POST["s5"];

$total=$s1+$s2+$s3+$s4+$s5;

$avg=($s1+$s2+$s3+$s4+$s5)/5;

echo "MY NAME:$n<BR></BR>";

echo "SUBJECT1 MARK:$s1<BR></BR>";

echo "SUBJECT2 MARK:$s2<BR></BR>";

echo "SUBJECT3 MARK:$s3<BR></BR>";

echo "SUBJECT4 MARK:$s4<BR></BR>";

echo "SUBJECT5 MARK:$s5<BR></BR>";

echo "TOTAL:$total<BR></BR>";

echo "AVG:$avg<BR></BR>";

if(($s1>=50)&&($s2>=50)&&($s3>=50)&&($s4>=50)&&($s5>=50))

echo "RESULT:PASS";
else

echo "RESULT:FAIL";

?>

<BR>

</CENTER>

</BODY>

</HTML>

OUTPUT:-
EX.NO:9
EMPLOYEE PAYSLIP

AIM:

Write a PHP program to create Employee Payslip

ALGORITHM:

STEP1 : Start the program.

STEP2 : Open notepad and start to type the program.

STEP3 : Design the form using HTML and CSS and get empno , empname ,

dept , dob,basicpay as input from the user

STEP4: Write the PHP Code to Calculate the HRA, TA, DA , PF and Netpay

STEP5 : Display the output

STEP6 : Stop the program.

EX.NO:9 EMPLOYEE PAYSLIP


payslip.html

<html>

<body bgcolor="red">

<form action="payslip.php" method="POST">

Enter Employee Number:

<input type="text" name="no1" required>

</br></br>

Enter Employee Name:

<input type="text" name="na1" required>

</br></br>

Enter Employee Month:

<select name="m">

<option>1</option>

<option>2</option>

<option>3</option>

<option>4</option>

<option>5</option>

<option>6</option>

<option>7</option>

<option>8</option>

<option>9</option>

<option>10</option>

<option>11</option>
<option>12</option>

</select></br></br>

Enter Basicpay:

<input type="text" name="basic" required>

</br></br>

<input type="submit" value="calculatesalary">

</form>

</body>

</html>

Payslip.php

<html>

<head>

<h1 align="center">Payslip</h1>

</head>

<body bgcolor="pink">

<?php

$eno=$_POST["no1"];

$ename=$_POST["na1"];

$month=$_POST["m"];

$bp=$_POST["basic"];

$hra=$bp*0.12;

$da=$bp*0.14;

$pf=500;
$lic=500;

$np=$bp+$hra+$da-$pf-$lic;

echo "Employee Number $eno</br>";

echo "Employee Name $ename</br>";

echo "Employee Month $month</br>";

echo "Employee BasicPay $bp</br>";

echo "Employee HRA $hra</br>";

echo "Employee DA $da</br>";

echo "Employee PF $pf</br>";

echo "Employee LIC $lic</br>";

echo "Employee NetPay $np</br>";

?>

</html>

OUTPUT:-
EX.NO:10
ELIGIBLE TO VOTE OR NOT

AIM:

Write a PHP program to create eligibility to vote or not

ALGORITHM:

STEP 1 : Start the program.

STEP 2 : Open notepad and start to type the program.

STEP 3 : Design the input form using HTML and get name & age as

input from user

STEP 4 : Write the PHP Code to check whether the person is eligible to vote or

not using If statement.

STEP 5 : If so, display that the person is eligible to vote.

STEP 6 : Otherwise display that the person is not eligible to vote and calculate

the number of years he/she have to wait. Display the results in Screen

STEP 7 : Stop the program.

EX.NO:10 ELIGIBLE TO VOTE OR NOT


eligible.html

<html>

<head>

<center><h1>Eligible to vote or not</h1></center>

</head>

<body bgcolor="green">

<form action="eligible.php" method="POST">

Enter Your Name:

<input type="text" name="n1"></br></br>

Enter Your Age:

<input type="text" name="age"></br></br>

<input type="submit" value="check">

</form>

</body>

</html>

eligible.php

<html>
<head>

<center><h1>Eligible to vote or not</h1></center>

</head>

<body bgcolor="pink">

<?php

$name=$_POST["n1"];

$age=$_POST["age"];

if ($age>=19)

echo"$name is ELIGIBLE TO VOTE";

else

$diff=19-$age;

echo "$name is NOT ELIGIBLE TO VOTE<br>";

echo" $name you have to wait for $diff years";

?>

OUTPUT:-

You might also like