Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Paste2
- Create Paste
- Followup Paste
- QR
- Internet And Web Programming
- LAB 1
- Activity 1:
- CODE:
- <html>
- <title>
- Enrollment Application
- </title>
- <head>
- </head>
- <center>
- <h1 style="color:blue">
- VIT Student FOOTBALL TEAM Application
- </h1>
- <img src="http://vit.ac.in/images/logo1.png" width="300" length="300">
- <body>
- <p style="color:white">VISIT VIT, A PLACE TO LEARN, A CHANCE TO
- GROW</p>
- <a href="http://vit.ac.in">Click here</a><br><br>
- <table>
- <tr>
- <td>First Name:</td>
- <td><input type="text" name="fname"><br></td>
- </tr>
- <tr>
- <td>Last Name:</td>
- <td><input type="text" name="lname"></td>
- </tr>
- <tr>
- <td>Age:</td>
- <td><input type="number" name="age" min="0"></td>
- </tr>
- <tr>
- <td>Reg.No:</td>
- <td><input type="text" name="regno" min="9" max="9"><br></td>
- </tr>
- <tr>
- <td>Email:</td>
- <td><input type="email" name="mail"></td>
- </tr>
- <tr>
- <td>School:</td>
- <td><input type="radio" name="cse">SCOPE<br>
- <input type="radio" name="ece">SENSE<br>
- <input type="radio" name="mech">SMEC<br>
- <input type="radio" name="eee">SELECT<br>
- </td>
- </tr>
- <tr>
- <td>CGPA:</td>
- <td><input type="range" name="cgpa" min="0,0" max="10.0"></td>
- </tr>
- <tr>
- <td>Interested Position: </td>
- <td><input type="checkbox" name="cp">Striker<br>
- <input type="checkbox" name="ch">Defender<br>
- <input type="checkbox" name="sh">MIdfielder<br>
- <input type="checkbox" name="ah">Goalkeeper<br>
- </td>
- </tr>
- <tr>
- <td>Student Password:</td>
- <td><input type="password" name="pass" required></td>
- </tr>
- <tr>
- <td>Date & Time:</td>
- <td><input type="datetime-local"></td>
- </tr>
- </table>
- <br>
- <input type="submit">   <input type="reset">
- </body>
- </center>
- </html>
- Activity 2:
- CODE:
- <!DOCTYPE html>
- <!--
- To change this license header, choose License Headers in Project Properties.
- To change this template file, choose Tools | Templates
- and open the template in the editor.
- -->
- <html>
- <style> { background-color: green; } </style>
- <head>
- <title>My Resume</title>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- </head>
- <body>
- <div id="header"></div>
- <div class="left"></div>
- <div class="stuff">
- <br><br>
- <h2>BELAL AHMED</h2>
- <hr />
- <br>
- <p class="head">Interests</p>
- <ul>
- <li>Football</li>
- <li>Photography</li>
- <li>Design</li>
- <li>Programming</li>
- <li>Computer Science</li>
- </ul>
- <p class="head">Skills</p>
- <ul>
- <li>Web Design with HTML & CSS</li>
- </ul>
- <p class="head">Education</p>
- <ul>
- <li>St.Joseph Academy</li>
- <li>VIT UNIVERSITY</li>
- </ul>
- <p class="head">Experience</p>
- <ul>
- <li>ACM Club Chapter</li>
- <li>Intern At Oil And Natural Gas Corporation</li>
- </ul>
- <p class="head">Extracurriculars</p>
- <ul>
- <li>Football</li>
- <li>Cricket</li>
- <li>Book Club</li>
- </ul>
- </div>
- <div class="right"></div>
- <div id="footer">
- <h2 id="name">Belal</h2></div>
- </body>
- </html>
- Activity 3:
- CODE:
- <!DOCTYPE html>
- <html>
- <body>
- <audio controls>
- <source src="horse.ogg" type="audio/ogg">
- <source src="horse.mp3" type="audio/mpeg">
- Your browser does not support the audio element.
- </audio>
- <video width="320" height="240" controls>
- <source src="movie.mp4" type="video/mp4">
- <source src="movie.ogg" type="video/ogg">
- Your browser does not support the video tag.
- </video>
- </body>
- </html>
- Activity 4:
- CODE:
- <!DOCTYPE html>
- <html>
- <head>
- <style>
- div {
- border: 25px solid green;
- padding: 25px;
- margin: dashed;
- margin: 25px;
- text-align:center;
- width: 500px;
- background-color:white;
- border-top-color:yellow;
- outline-width: dashed;
- }
- </style>
- </head>
- <body>
- <div>BILAL AHMED</div>
- </body>
- </html>
- Activity 5:
- CODE:
- <!DOCTYPE html>
- <html>
- <head>
- <style>
- ul {
- list-style: none;
- padding: 0;
- margin: 0;
- background: green;
- }
- ul li {
- display: block;
- position: relative;
- float: left;
- background: green;
- }
- li ul { display: none; }
- ul li a {
- display: block;
- padding: 1em;
- text-decoration: none;
- white-space: nowrap;
- color: #fff;
- }
- ul li a:hover { background: red; }
- li:hover > ul {
- display: block;
- position: absolute;
- }
- li:hover li { float: none; }
- li:hover a { background: #1bc2a2; }
- li:hover li a:hover { background: green; }
- .main-navigation li ul li { border-top: 0; }
- ul ul ul {
- left: 100%;
- top: 0;
- }
- ul:before,
- ul:after {
- content: " "; /* 1 */
- display: table; /* 2 */
- }
- ul:after { clear: both; }
- </style>
- </head>
- <body>
- <ul class="main-navigation">
- <li><a href="#">Home</a></li>
- <li><a href="#">Teacher</a>
- <ul>
- <li><a href="#">SENSE</a></li>
- <li><a href="#">SITE</a>
- <li><a href="#">SCOPE</a>
- <ul>
- <li><a href="#">Nalini N</a></li>
- <li><a href="#">Lokesh KUmar</a></li>
- <li><a href="#">Arun Kumar S</a></li>
- </ul>
- </li>
- </ul>
- </li>
- <li><a href="#">Staff</a>
- </li>
- <li><a href="#">About</a></li>
- </ul>
- </body>
- </html>
- Activity 6:
- CODE:
- <!DOCTYPE html>
- <html>
- <head>
- <style>
- body
- {background-color: #ddd;
- text-align:center;
- }
- h5 {color:red;}
- p.dotted {border-style: dotted;}
- p.dashed {border-style: dashed;}
- p.solid {border-style: solid;}
- p.double {border-style: double;}
- p.groove {border-style: groove;}
- p.ridge {border-style: ridge;}
- p.inset {border-style: inset;}
- p.outset {border-style: outset;}
- p.none {border-style: none;}
- p.hidden {border-style: hidden;}
- p.mix {border-style: dotted dashed solid double;}
- </style>
- </head>
- <body>
- <table>
- <tr>
- <td>
- <p class="none">No border.</p>
- <p class="dotted">A dotted border.</p>
- <p class="dashed">A dashed border.</p>
- <p class="solid">A solid border.</p>
- <p class="double">A double border.</p>
- </td>
- <td>
- <p class="groove">A groove border.</p>
- <p class="ridge">A ridge border.</p>
- <p class="inset">An inset border.</p>
- <p class="outset">An outset border</p>
- <p class="hidden">A hidden border.</p>
- </td>
- </tr>
- </table>
- </body>
- </html>
- Activity 7:
- CODE:
- Question 7
- <html>
- <head>
- <style>
- table, th, td {
- border: 1px solid black;
- border-collapse: collapse;
- }
- .hovertable tr:hover {
- background-color: yellow;
- }
- td{
- padding: 15px;
- }
- </style>
- </head>
- <body>
- <table class="hovertable">
- <tr style='background-color: skyblue'>
- <td>#</td>
- <td>IMDB Top 10 Movies</td>
- <td>Year</td>
- </tr>
- <tr onmouseover="ChangeBackgroundColor(red)"
- onmouseout="RestoreBackgroundColor(white)">
- <td>1</td>
- <td>The Shawshank Redemption</td>
- <td>1994</td>
- </tr>
- <tr>
- <td>2</td>
- <td>The Godfather</td>
- <td>1972</td>
- </tr>
- <tr>
- <td>3</td>
- <td>The Godfather:PartII</td>
- <td>1974</td>
- </tr>
- <tr>
- <td>4</td>
- <td>The Good,the Bad and the Ugly</td>
- <td>1966</td>
- </tr>
- <tr>
- <td>5</td>
- <td>Pulp Fiction</td>
- <td>1994</td>
- </tr>
- <tr>
- <td>6</td>
- <td>12 Angry Men</td>
- <td>1957</td>
- </tr>
- <tr>
- <td>7</td>
- <td>Schindler's list</td>
- <td>1993</td>
- </tr>
- <tr>
- <td>8</td>
- <td>One Flew Over the Cuckoo's Nest</td>
- <td>1975</td>
- </tr>
- <tr>
- <td>9</td>
- <td>The Dark Knight</td>
- <td>2008</td>
- </tr>
- <tr>
- <td>10</td>
- <td>The Lord of the Rings: The Return of the King</td>
- <td>2003</td>
- </tr>
- </table>
- </body>
- </html>
- Activity 8:
- CODE:
- <!DOCTYPE html>
- <html>
- <head>
- <style>
- body{background-color: #ddd}
- #boxshadow {
- position: relative;
- -moz-box-shadow: 1px 2px 4px rgba(0, 0, 0,0.5);
- -webkit-box-shadow: 1px 2px 4px rgba(0, 0, 0, .5);
- box-shadow: 1px 2px 4px rgba(0, 0, 0, .5);
- padding: 10px;
- background: white;
- }
- #boxshadow::after {
- content: '';
- position: absolute;
- z-index: -1;
- -webkit-box-shadow: 0 15px 20px rgba(0, 0, 0, 0.3);
- -moz-box-shadow: 0 15px 20px rgba(0, 0, 0, 0.3);
- box-shadow: 0 15px 20px rgba(0, 0, 0, 0.3);
- width: 70%;
- left: 15%;
- height: 100px;
- bottom: 0;
- }
- div.test {
- white-space: nowrap;
- width: 200px;
- overflow: hidden;
- border: 1px solid #ddd;
- }
- div.test:hover {
- text-overflow: inherit;
- overflow: visible;
- }
- h1 {
- text-align:center;
- color: white;
- text-shadow: 1px 1px 2px black, 0 0 25px blue, 0 0 5px green;
- }
- p.para1 {
- width: 15em;
- border: 1px solid #ddd;
- word-wrap: break-word;
- }
- s</style>
- </head>
- <body>
- <h1>INDIA</h1>
- <div id="boxshadow" align='center'>
- <br>
- <p><img src="https://www.w3schools.com/css/rock600x400.jpg" alt="Pineapple"
- style="width:170px;height:170px;margin-left:15px;">
- India (IAST: Bhārat), also called the Republic of India (IAST: Bhārat Gaṇarājya),[19][e] is a
- country in South Asia. It is the seventh-largest country by area, the second-most populous
- country (with over 1.2 billion people), and the most populous democracy in the world. It is
- bounded by the Indian Ocean on the south, the Arabian Sea on the southwest, and the Bay of
- Bengal on the southeast. It shares land borders with Pakistan to the west;[f] China, Nepal, and
- Bhutan to the northeast; and Bangladesh and Myanmar to the east. In the Indian Ocean, India
- is in the vicinity of Sri Lanka and the Maldives. India's Andaman and Nicobar Islands share a
- maritime border with Thailand and Indonesia.
- The Indian subcontinent was home to the urban Indus Valley Civilisation of the 3rd millennium
- BCE. In the following millennium, the oldest scriptures associated with Hinduism began to be
- composed. Social stratification, based on caste, emerged in the first millennium BCE, and
- Buddhism and Jainism arose. Early political consolidations took place under the Maurya and
- Gupta empires; the later peninsular Middle Kingdoms influenced cultures as far as southeast
- Asia. In the medieval era, Judaism, Zoroastrianism, Christianity, and Islam arrived, and
- Sikhism emerged, all adding to the region's diverse culture. Much of the north fell to the Delhi
- sultanate; the south was united under the Vijayanagara Empire. The economy expanded in the
- 17th century in the Mughal Empire. In the mid-18th century, the subcontinent came under
- British East India Company rule, and in the mid-19th under British crown rule. A nationalist
- movement emerged in the late 19th century, which later, under Mahatma Gandhi, was noted
- for nonviolent resistance and led to India's independence in 1947.
- In 2017, the Indian economy was the world's sixth largest by nominal GDP[20] and third largest
- by purchasing power parity.[16]Following market-based economic reforms in 1991, India
- became one of the fastest-growing major economies and is considered a newly industrialised
- country. However, it continues to face the challenges of poverty, corruption, malnutrition, and
- inadequate public healthcare. A nuclear weapons state and regional power, it has the second
- largest standing army in the world and ranks fifth in military expenditure among nations. India
- is a federal republic governed under a parliamentary system and consists of 29 states and 7
- union territories. It is a pluralistic, multilingual and multi-ethnic society and is also home to a
- diversity of wildlife in a variety of protected habitats.
- </p>
- </div>
- <br>
- <div class="test" style="text-overflow:ellipsis;"><b>India, the country of all</b></div>
- <br>
- <p class="para1">The earliest authenticated human remains in South Asia date to about 30,000
- years ago.[27] Nearly contemporaneous Mesolithic rock art sites have been found in many
- parts of the Indian subcontinent, including at the Bhimbetka rock shelters in Madhya
- Pradesh.[28]Around 7000 BCE, one of the first known Neolithic settlements appeared on the
- subcontinent in Mehrgarh and other sites in the subcontinent.[29] These gradually developed
- into the Indus Valley Civilisation,[30] the first urban culture in South Asia;[31] it flourished
- during 2500–1900 BCE in northeast Afghanistan to Pakistan and northwest India.[32] Centred
- around cities such as Mohenjo-daro, Harappa, Dholavira, and Kalibangan, and relying on
- varied forms of subsistence, the civilisation engaged robustly in crafts production and wideranging
- trade</p>
- </body>
- </html>
- EXPERIMENT NO 2
- BELAL AHMED
- 16BCE0281
- QUESTION 1:
- CODE:
- <!DOCTYPE html>
- <html>
- <head>
- <title></title>
- </head>
- <body>
- <p> The total value of the goods sold is :</p>
- <p id="total_disp"></p>
- <script>
- var i, total=0;
- for( i=0 ; i< 5; i++){
- var a = prompt("Enter the product number");
- a = parseInt(a);
- switch(a){
- default:
- alert("You have enetered wrong value");
- case 1:
- b = prompt('Enter quantity');
- b = parseInt(b);
- total += 2.98 * b;
- break;
- case 2:
- b = prompt('Enter quantity');
- b = parseInt(b);
- total += 3.98 *b;
- break;
- case 3:
- b = prompt('Enter quantity');
- b = parseInt(b);
- total += 5 * b;
- break;
- case 4:
- b = prompt('Enter quantity');
- b = parseInt(b);
- total += 10 *b;
- break;
- case 5:
- b = prompt('Enter quantity');
- b = parseInt(b);
- total += 20 * b;
- break;
- }
- }
- document.getElementById('total_disp').innerHTML = total;
- </script>
- </body>
- </html>
- OUTPUT:
- QUESTION 2:
- CODE:
- <!DOCTYPE html>
- <html>
- <head>
- <title>slide</title>
- <style>
- div {text-align: center}
- </style>
- <script>
- var
- x=["https://www.w3schools.com/html/pic_trulli.jpg","https://www.w3schools.com/html/img
- _girl.jpg","https://www.w3schools.com/html/img_chania.jpg"];
- var z=0;
- function slide()
- {
- var y=x.length;
- document.getElementById('img1').src=x[z%y];
- z=z+1;
- }
- function change()
- {
- var e=document.getElementById('change').value;
- x.push(e);
- }
- </script>
- </head>
- <body>
- <div>
- <img src="https://www.w3schools.com/html/img_chania.jpg" alt="Flowers in Chania"
- id="img1" onclick="slide()" height="300" width="500">
- <br>
- <button onclick="slide()" type="textbox">change</button>
- <input name="Imagelink" type="text" id="change">
- <button type="submit" onclick="change()" value="Add">Add</button>
- </div>
- </body>
- </html>
- OUTPUT:
- QUESTION 3:
- CODE:
- <!DOCTYPE html>
- <html>
- <head>
- <title>Random</title>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <script>
- function ABC()
- {
- x=Math.floor(Math.random()*300);
- document.getElementById("IMG1").width=x;
- y=Math.floor(Math.random()*300);
- document.getElementById("IMG1").height=y;
- }
- </script>
- </head>
- <body>
- <div>
- <img src="https://www.w3schools.com/html/img_girl.jpg" alt="Img" id="IMG1"
- width="300" height="300" onclick="ABC()"/>
- <button onclick="ABC()">Random</button>
- </div>
- </body>
- </html>
- OUTPUT:
- EXPERIMENT NO 3
- BELAL AHMED
- 16BCE0281
- CODE:
- <!DOCTYPE html>
- <html>
- <head>
- <title>Digital Clock</title>
- <style>
- .clock {
- top: 50%;
- left: 50%;
- color: white;
- font-family: sans-serif;
- font-size: 60px;
- letter-spacing: 7px;
- text-align: center;
- }
- .day{
- color: white;
- }
- ul li{
- display: inline;
- color: darkgrey;
- }
- ul{
- word-spacing: 7px;
- padding: 0px;
- font-family: sans-serif;
- text-align: center;
- }
- .bound{
- border:35px solid grey;
- background-color: black;
- width: 100%;
- }
- .corner{
- position: fixed;
- bottom: 0;
- right: 70px;
- }
- </style>
- </head>
- <body>
- <div class="corner">
- <div id="boundary" class="bound">
- <ul>
- <li id="Mon">Mon</li>
- <li id="Tues">Tue</li>
- <li id="Wed">Wed</li>
- <li id="Thu">Thu</li>
- <li id="Fri">Fri</li>
- <li id="Sat">Sat</li>
- <li id="Sun">Sun</li>
- </ul>
- <div id="ClockDisplay" class="clock"></div>
- <div id="DayDisplay" class="day"> </div>
- </div>
- <script>
- function showTime()
- {
- var date = new Date();
- var h = date.getHours();
- var m = date.getMinutes();
- var s = date.getSeconds();
- h=(h<10)?"0"+h:h;
- m=(m<10)?"0"+m:m;
- s=(s<10)?"0"+s:s;
- var time=h+":"+m+":"+s;
- document.getElementById("ClockDisplay").innerText=time;
- document.getElementById("ClockDisplay").textContent=time;
- var days = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
- var curWeekDay = days[date.getDay()];
- var day = curWeekDay;
- switch(day)
- {
- case "Mon":
- document.getElementById("Mon").style.color="white";
- break;
- case "Tue":
- document.getElementById("Tue").style.color="white";
- break;
- case "Wed":
- document.getElementById("Wed").style.color="white";
- break;
- case "Thu":
- document.getElementById("Thu").style.color="white";
- break;
- case "Fri":
- document.getElementById("Fri").style.color="white";
- break;
- case "Sat":
- document.getElementById("Sat").style.color="white";
- break;
- case "Sun":
- document.getElementById("Sun").style.color="white";
- break;
- }
- setTimeout(showTime, 1000);
- }
- showTime();
- </script>
- </div>
- </body>
- </html>
- OUTPUT:
- EXPERIMENT NO 4
- 16BCE0281
- BELAL AHMED
- CODE:
- Sale.php
- <html>
- <head>
- <title>
- Car Amount Calculator
- </title>
- <style>
- table,
- td,
- tr {
- border: 1px solid black;
- border-collapse: collapse;
- }
- </style>
- </head>
- <body>
- <h1>
- Please enter the following details.
- </h1>
- <form name =”16bce0281”method="post" action='action.php'>
- <table>
- <tr>
- <td>
- Car Plate:
- </td>
- <td>
- <input type="text" name="car_plate" placeholder="Plate number">
- </td>
- </tr>
- <tr>
- <td>
- Car Brand:
- </td>
- <td>
- <select name="car_brand" required>
- <option value="astra">Astra</option>
- <option value="civic">Civic</option>
- <option value="megane">Megane</option>
- </select>
- </td>
- </tr>
- <tr>
- <td>
- Airbag:
- </td>
- <td>
- <input type="checkbox" name="airbag">
- </td>
- </tr>
- <tr>
- <td>
- Engine:
- </td>
- <td>
- <input type="radio" value="e_16" name="engine" required> 1.6
- <input type="radio" value="e_18" name="engine" required>1.8
- <input type="radio" value="e_20" name="engine" required>2.0
- </td>
- </tr>
- <tr>
- <td colspan="2" style="text-align: center;">
- <input type="submit" value="Calculate" name="calc">
- </td>
- </tr>
- </table>
- </form>
- </body>
- </html>
- action.php
- <html>
- <body>
- <?php
- $car_price = $car = $engine_price = $car_plate = 0;
- $airbag_price = $total = 0;
- if($_SERVER['REQUEST_METHOD']=='POST'){
- $car_plate = $_POST['car_plate'];
- if(!preg_match("^[0-9]{2} [aA-zZ]{1,3} [0-9]{2,4}$^", $car_plate)){
- echo "Car Plate number is invalid";
- }
- else{
- $car = $_POST['car_brand'];
- switch($car){
- case "astra":
- $car_price = 20000;
- break;
- case "civic":
- $car_price = 25000;
- break;
- case "megane":
- $car_price = 18000;
- break;
- }
- $engine_price = $_POST["engine"];
- switch($engine_price){
- case "e_16":
- $engine_price = 1.6;
- break;
- case "e_18":
- $engine_price = 1.8;
- break;
- case "e_20":
- $engine_price = 2.0;
- break;
- }
- if(isset($_POST["airbag"]) && !empty($_POST["airbag"])){
- $airbag_price = 2000;
- }
- // Debugging purposes
- // echo $car;
- // echo $car_price;
- // echo "\n";
- // echo $engine_price;
- // echo "\n";
- // echo $airbag_price;
- $total = $car_price * $engine_price + $airbag_price;
- echo "Total price for ",$_POST['car_brand'] ," ",$total," TL";
- echo $total;
- }
- }
- ?>
- <br>
- <a href="sale.php">Back</a>
- </body>
- </html>
- OUTPUT:
- EXPERIMENT NO.5
- 16BCE0281
- BELAL AHMED
- Code:
- lab.php
- <html>
- <head>
- <title>
- 16BCE0281
- </title>
- <meta charset="utf-8" />
- <style>
- table,
- th,
- td {
- border: 1px solid black;
- border-collapse: collapse;
- }
- td {
- width: auto;
- }
- .button {
- text-decoration: underline;
- color: purple;
- }
- </style>
- </head>
- <body>
- <?php
- // Main menu
- $food_menu = file("food.txt", FILE_IGNORE_NEW_LINES);
- $menu_mon = explode(":!:", $food_menu[0]);
- $menu_tue = explode(":!:", $food_menu[1]);
- $menu_wed = explode(":!:", $food_menu[2]);
- $menu_thu = explode(":!:", $food_menu[3]);
- $menu_fri = explode(":!:", $food_menu[0]);
- ?>
- <form method="POST" action="update_menu.php">
- <table>
- <tr>
- <td>
- <input type="submit" value="Monday" name="mon" class="button">
- </td>
- <td>
- <p name="starter">
- <?php
- echo $menu_mon[1];
- ?>
- </p>
- ---
- <p name="main">
- <?php
- echo $menu_mon[2];
- >
- </p>
- ---
- <p name="des">
- <?php
- echo $menu_mon[3];
- ?>
- </p>
- </td>
- </tr>
- <tr>
- <td>
- <input type="submit" value="Tuesday" name="tue" class="button">
- </td>
- <td>
- <p name="starter">
- <?php
- echo $menu_tue[1];
- ?>
- </p>
- ---
- <p name="main">
- <?php
- echo $menu_tue[2];
- ?>
- </p>
- ---
- <p name="des">
- <?php
- echo $menu_tue[3];
- ?>
- </p>
- </td>
- </tr>
- <tr>
- <td>
- <input type="submit" value="Wednesday" name="wed" class="button">
- </td>
- <td>
- <p name="starter">
- <?php
- echo $menu_wed[1];
- ?>
- </p>
- ---
- <p name="main">
- <?php
- echo $menu_wed[2];
- ?>
- </p>
- ---
- <p name="des">
- <?php
- echo $menu_wed[3];
- ?>
- </p>
- </td>
- </tr>
- <tr>
- <td>
- <input type="submit" value="Thursday" name="thu" class="button">
- </td>
- <td>
- <p name="starter">
- <?php
- echo $menu_thu[1];
- ?>
- </p>
- ---
- <p name="main">
- <?php
- echo $menu_thu[2];
- ?>
- </p>
- ---
- <p name="des">
- <?php
- echo $menu_thu[3];
- ?>
- </p>
- </td>
- </tr>
- <tr>
- <td>
- <input type="submit" value="Friday" name="fri" class="button">
- </td>
- <td>
- <p name="starter">
- <?php
- echo $menu_fri[1];
- ?>
- </p>
- ---
- <p name="main">
- <?php
- echo $menu_fri[2];
- ?>
- </p>
- ---
- <p name="des">
- <?php
- echo $menu_fri[3];
- ?>
- </p>
- </td>
- </tr>
- </table>
- </form>
- </body>
- </html>
- Update_form.php
- <html>
- <body>
- <?php
- //Using isset()
- settype($day, "integer");
- if(isset($_POST["mon"])){
- $day = 0;
- }
- elseif(isset($_POST["tue"])){
- $day = 1;
- }
- elseif(isset($_POST["wed"])){
- $day = 2;
- }
- elseif(isset($_POST["thu"])){
- $day = 3;
- }
- elseif(isset($_POST["fri"])){
- $day = 4;
- }
- // echo $day;
- // Main menu
- $food_menu = file("food.txt", FILE_IGNORE_NEW_LINES);
- $menu_day_selected = explode(":!:", $food_menu[$day]);
- //echo $menu_day_selected[1];
- ?>
- <form method="post" action="update_food.php">
- <table>
- <tr>
- <td>
- Day:
- </td>
- <td>
- <input type="text" name="day" value="<?php echo
- $menu_day_selected[0];?>" readonly><br>
- </td>
- </tr>
- <tr>
- <td>
- Starter:
- </td>
- <td>
- <input type="text" name="starter" value="<?php echo
- $menu_day_selected[1];?>"><br>
- </td>
- </tr>
- <tr>
- <td>
- Main Course:
- </td>
- <td>
- <input type="text" name="main_course" value="<?php echo
- $menu_day_selected[2];?>"><br>
- </td>
- </tr>
- <tr>
- <td>
- Dessert:
- </td>
- <td>
- <input type="text" name="des" value="<?php echo
- $menu_day_selected[3];?>"><br>
- </td>
- </tr>
- <tr>
- <td colspan="2" style="text-align:center;">
- <input type="submit" value="Update" name="update_txt">
- </td>
- </tr>
- <tr>
- <td>
- <a href="lab.php">Back to menu</a>
- </td>
- </tr>
- </table>
- </form>
- </body>
- </html>
- Update.php
- <?php
- $food_menu = file("food.txt", FILE_IGNORE_NEW_LINES);
- // print_r ($food_menu);
- //$current_day = "";
- if(isset($_POST['day'])){
- $current_day = $_POST['day'];
- switch($current_day){
- case 'MONDAY':
- $menu_day = 0;
- break;
- case 'TUESDAY':
- $menu_day = 1;
- break;
- case 'WEDNESDAY':
- $menu_day = 2;
- break;
- case 'THURSDAY':
- $menu_day = 3;
- break;
- case 'FRIDAY':
- $menu_day = 4;
- break;
- }
- $menu_day_exploded = explode(":!:",$food_menu[$menu_day]);
- // echo $menu_day_exploded[0];
- $starter = $_POST['starter'];
- $main_course = $_POST['main_course'];
- $des = $_POST['des'];
- // echo $des;
- //replacing the array vals
- // echo $menu_day_exploaded[0];
- $menu_day_exploaded[0] = $current_day;
- $menu_day_exploaded[1] = $starter;
- $menu_day_exploaded[2] = $main_course;
- $menu_day_exploaded[2] = $des;
- // print_r($menu_day_exploaded);
- $final = $menu_day_exploaded;
- // print_r($final);
- // echo $menu_day_exploaded[3];
- $imploded_vals = implode(":!:", $final);
- $food_menu[$menu_day] = $imploded_vals;
- // echo $food_menu;
- // echo $food_menu[$menu_day];
- // print_r($food_menu);
- // $fp = fopen('file.txt', 'w');
- // fwrite($fp, print_r($food_menu, TRUE));
- // fclose($fp);
- file_put_contents('food.txt', implode(PHP_EOL, $food_menu));
- echo '<script>window.location.href = "lab.php";</script>';
- }
- ?>
- Output 1: using readonly for day input
- Icecream to Gulab Jamun
- Update in the main menu.
- Output 2: without using readonly for day input
- TUESDAY CHANGED TO THURSDAY
- Now Thursday and Tuesday both have same menu
- EXPERIMENT NO 6
- 16BCE0281
- BELAL AHMED
- Question :
- a) Write a query that lists the names of the movies whose title contains the word “space”
- in descending order by rank.
- CODE:
- <html>
- <body>
- <head>
- <title>
- 16BCE0281
- </title>
- <style>
- .table{
- align:center;
- padding:5px;
- margin-top:500px,
- border-spacing: 10px;
- font-size:44;
- }
- </style>
- </head>
- <body>
- <div align="center">
- <table border="1" class="table">
- <tr>
- <th>Id</th>
- <th>Name</th>
- <th>Year</th>
- <th>Rank</th>
- </tr>
- <?php
- $servername = "localhost";
- $username = "";
- $password = "";
- // Create connection
- $conn = mysqli_connect($servername, $username, $password,"test");
- $sql = "select * from movies where movies.name like '%Space%' order by movies.rank
- desc;";
- $result = $conn->query($sql);
- while($row = $result->fetch_assoc()) {
- echo "<tr>";
- echo "<td>" . $row['id'] ."</td>";
- echo "<td>" . $row['name'] . "</td>";
- echo "<td>" . $row['movies'] . "</td>";
- echo "<td>" . $row['rank'] . "</td>";
- echo "</tr>";
- }
- $conn->close();
- ?>
- </table>
- </div>
- </body>
- </html>
- OUTTPUT:
- b) Write a query that lists the female actors who appeared in a movie during the 90s (1990-
- 1999) that was rated higher than 8.5.
- Code:
- <html>
- <body>
- <head>
- <title>
- 16BCE0281
- </title>
- <style>
- .table{
- align:center;
- padding:5px;
- margin-top:500px,
- border-spacing: 10px;
- font-size:44;
- }
- </style>
- </head>
- <body>
- <h1 align="center"BELAL AHMED</h1>
- <br/>
- <div align="center">
- <table border="1" class="table">
- <tr>
- <th>First Name</th>
- <th>Last Name</th>
- </tr>
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "1234";
- // Create connection
- $conn = mysqli_connect($servername, $username, $password,"test");
- $sql = "select actors.first_name,actors.last_name from((actors inner join roles on
- actors.id=roles.actor_id) inner join movies on roles.movie_id=movies.id) where
- actors.gender='F' and movies.movies between 1990 and 1995 and movies.rank>8.5";
- $result = $conn->query($sql);
- while($row = $result->fetch_assoc()) {
- echo "<tr>";
- echo "<td>" . $row['first_name'] ."</td>";
- echo "<td>" . $row['last_name'] . "</td>";
- echo "</tr>";
- }
- $conn->close();
- ?>
- </table>
- </div>
- </body>
- </html>
- OUTTPUT:
- c) Write a query that lists all actors who was in a movie rated lower than 3.0 two or more
- times. List the name of the actor, the movie and each rating, ordered ascending by the actors’
- last name then first name.
- Code:
- <html>
- <body>
- <head>
- <title>
- 16BCE0281
- </title>
- <style>
- .table{
- align:center;
- padding:5px;
- margin-top:500px,
- border-spacing: 10px;
- font-size:44;
- }
- </style>
- </head>
- <body>
- <h1 align="center" BELAL AHMED</h1>
- <br/>
- <h1 align="center">Question c.</h1>
- <div align="center">
- <table border="1" class="table">
- <tr>
- <th>Actor First Name</th>
- <th>Actor Last Name</th>
- <th>Movie Name</th>
- <th>Rank</th>
- </tr>
- <?php
- $servername = "localhost";
- $username = "";
- $password = "";
- // Create connection
- $conn = mysqli_connect($servername, $username, $password,"test");
- $sql = "select actors.first_name,actors.last_name,movies.name,movies.rank from(((actors
- inner join roles on actors.id=roles.actor_id)inner join movies on roles.movie_id
- =movies.id)inner join movie_genres on movies.id=movie_genres.movie_id) where (select
- count(*) from movies where movies.rank<3)>=2 order by actors.first_name asc;
- ";
- $result = $conn->query($sql);
- if ($result->num_rows > 0) {
- while($row = $result->fetch_assoc()) {
- echo "<tr>";
- echo "<td>" . $row['first_name'] ."</td>";
- echo "<td>" . $row['last_name'] . "</td>";
- echo "<td>" . $row['name'] . "</td>";
- echo "<td>" . $row['rank'] . "</td>";
- echo "</tr>";
- }
- }
- else
- echo " <h1>0 results</h1> ";
- $conn->close();
- ?>
- </table>
- </div>
- </body>
- </html>
- OUTTPUT:
- d) Write a query that lists all actors who have been in two or more movies of different genres.
- List their name, movie and their respective genres.
- Code:
- <html>
- <body>
- <head>
- <title>
- 16BCE0281
- </title>
- <style>
- .table{
- align:center;
- padding:5px;
- margin-top:500px,
- border-spacing: 10px;
- font-size:44;
- }
- </style>
- </head>
- <body>
- <h1 align="center"> Belal AHMED</h1>
- <br/>
- <h1 align="center">Question d.</h1>
- <div align="center">
- <table border="1" class="table">
- <tr>
- <th>ID</th>
- <th>Movie Name</th>
- <th>Year</th>
- <th>Rank</th>
- </tr>
- <?php
- $servername = "localhost";
- $username = "";
- $password = "";
- // Create connection
- $conn = mysqli_connect($servername, $username, $password,"test");
- $sql = "select * from movies where(select count(actors.id) from(((actors inner join roles on
- actors.id=roles.actor_id)inner join movie_genres on
- roles.movie_id=movie_genres.movie_id)inner join movies on
- movies.id=roles.movie_id))>=2; ";
- $result = $conn->query($sql);
- if ($result->num_rows > 0) {
- while($row = $result->fetch_assoc()) {
- echo "<tr>";
- echo "<td>" . $row['id'] ."</td>";
- echo "<td>" . $row['name'] . "</td>";
- echo "<td>" . $row['movies'] . "</td>";
- echo "<td>" . $row['rank'] . "</td>";
- echo "</tr>";
- }
- }
- else
- echo " <h1>0 results</h1> ";
- $conn->close();
- ?>
- </table>
- </div>
- </body>
- </html>
- OUTPUT:
- e) Write update query -update “action” genres into “horror” and display no.of rows affected.
- Code:
- <html>
- <body>
- <head>
- <title>
- 16BCE0281
- </title>
- <style>
- .table{
- align:center;
- padding:5px;
- margin-top:500px,
- border-spacing: 10px;
- font-size:44;
- }
- </style>
- </head>
- <body>
- <h1 align="center"> BELAL AHMED</h1>
- <br/>
- <h1 align="center">Question e.</h1>
- <div align="center">
- <table border="1" class="table">
- <tr>
- <th>Movie ID</th>
- <th>Genre</th>
- </tr>
- <?php
- $servername = "localhost";
- $username = "";
- $password = "";
- // Create connection
- $conn = mysqli_connect($servername, $username, $password,"test");
- $sql1 = "update movie_genres set genre='action' where genre='horror'";
- $conn->query($sql1);
- $sql = "select * from movie_genres";
- $result = $conn->query($sql);
- if ($result->num_rows > 0) {
- while($row = $result->fetch_assoc()) {
- echo "<tr>";
- echo "<td>" . $row['movie_id'] ."</td>";
- echo "<td>" . $row['genre'] . "</td>";
- echo "</tr>";
- }
- }
- else
- echo " <h1>0 results</h1> ";
- $conn->close();
- ?>
- </table>
- </div>
- </body>
- </html>
- OUTTPUT:
- BEFORE UPDATE:
- AFTER UPDATE:
- EXPERIMENT NO 7
- 16BCE0281
- BELAL AHMED
- Q1.
- CODE:
- import java.util.Scanner ;
- import java.io.*;//import java.lang.*;
- public class bilal implements CharSequence {
- private String s;
- public bilal(String s) {
- //It would be much more efficient to just reverse the string
- //in the constructor. But a lot less fun!
- this.s = s;
- }
- //If the string is backwards, the end is the beginning!
- private int fromEnd(int i) {
- return s.length() - 1 - i;
- }
- public char charAt(int i) {
- if ((i < 0) || (i >= s.length())) {
- throw new StringIndexOutOfBoundsException(i);
- }
- return s.charAt(fromEnd(i));
- }
- public int length() {
- return s.length();
- }
- public CharSequence subSequence(int start, int end) {
- if (start < 0) {
- throw new StringIndexOutOfBoundsException(start);
- }
- if (end > s.length()) {
- throw new StringIndexOutOfBoundsException(end);
- }
- if (start > end) {
- throw new StringIndexOutOfBoundsException(start - end);
- }
- StringBuilder sub =
- new StringBuilder(s.subSequence(fromEnd(end), fromEnd(start-1)));
- System.out.println("Using subsequence string function ");
- return sub.reverse();
- }
- public String toString() {
- StringBuilder s = new StringBuilder(this.s);
- System.out.println("Using toString Function function \n");
- return s.reverse().toString();
- }
- public static void main(String[] args) {
- String st;
- System.out.println("Code written by BELAL AHMED 16BCE0281");
- System.out.println("Enter the string to be reversed");
- Scanner keyboard = new Scanner( System.in ) ;
- st = keyboard.nextLine();
- bilal s = new bilal(st);
- //exercise charAt() and length()
- for (int i = 0; i < s.length(); i++) {
- System.out.print(s.charAt(i));
- }
- System.out.println("");
- //exercise subSequence() and length();
- // h
- System.out.println(s.subSequence(0,st.length()-1));
- }
- }
- OUTPUT:
- Q2.
- CODE:
- import java.time.* ; // for classes LocalDate, Period
- import java.time.temporal.WeekFields ;
- import java.util.Scanner ;
- class EnglishCalendar
- {
- protected int this_year ;
- protected int this_month ;
- protected String[] names_of_months ;
- protected String week_description ;
- public EnglishCalendar()
- {
- }
- public EnglishCalendar( int given_year, int given_month )
- {
- String[] english_names_of_months ={ "January", "February", "March", "April","May",
- "June", "July", "August","September", "October", "November", "December" } ;
- String english_week_description = " Week Mon Tue Wed Thu Fri Sat Sun" ;
- names_of_months = english_names_of_months ;
- week_description = english_week_description ;
- this_year = given_year ;
- this_month = given_month ;
- }
- public int get_calendar_year()
- {
- return this_year ;
- }
- public int get_calendar_month()
- {
- return this_month ;
- }
- public void increment_calendar_month()
- {
- this_month ++ ;
- if ( this_month > 12 )
- {
- this_month = 1 ;
- this_year ++ ;
- }
- }
- public void decrement_calendar_month()
- {
- this_month -- ;
- if ( this_month < 1 )
- {
- this_month = 12 ;
- this_year -- ;
- }
- }
- public void first_month()
- {
- this_month=1;
- this_year++;
- }
- public void print()
- {
- LocalDate a_day_in_this_month = LocalDate.of( this_year, this_month, 1 ) ;
- // Days of week are numbered from 1 to 7.
- // The first day of week is Monday.
- int day_of_week_value = 1 ;
- int day_of_week_of_first_day = a_day_in_this_month.getDayOfWeek().getValue() ;
- System.out.print("\n\n " + names_of_months[ this_month - 1 ]+ " " + this_year + "\n\n" +
- week_description + "\n\n");
- System.out.printf( "%4d ",
- a_day_in_this_month.get(WeekFields.ISO.weekOfWeekBasedYear()) ) ;
- // The first week of a month is often an incomplete week,
- // i.e., the first part of week belongs to the previous
- // month. In place of the days that belong to the previous
- // month we print just spaces.
- while ( day_of_week_value != day_of_week_of_first_day )
- {
- System.out.print( " " ) ;
- day_of_week_value ++ ;
- }
- while ( this_month == a_day_in_this_month.getMonthValue() )
- {
- if ( day_of_week_value >= 8 )
- {
- System.out.printf( "\n%4d
- ",a_day_in_this_month.get(WeekFields.ISO.weekOfWeekBasedYear()) ) ;
- day_of_week_value = 1 ;
- }
- System.out.printf( "%5d", a_day_in_this_month.getDayOfMonth() ) ;
- a_day_in_this_month = a_day_in_this_month.plusDays( 1 ) ;
- day_of_week_value ++ ;
- }
- System.out.print( "\n" ) ;
- }
- }
- class SpanishCalendar extends EnglishCalendar
- {
- public SpanishCalendar( int given_year, int given_month )
- {
- String[] spanish_names_of_months ={ "Enero", "Febrero", "Marzo", "Abril","Mayo",
- "Junio", "Julio", "Agosto","Septiembre", "Octubre", "Noviembre", "Diciembre" } ;
- String spanish_week_description ="Semana Lun Mar Mie Jue Vie Sab Dom" ;
- names_of_months = spanish_names_of_months ;
- week_description = spanish_week_description ;
- this_year = given_year ;
- this_month = given_month ;
- }
- }
- public class MonthCalendars
- {
- public static void main( String[] not_in_use )
- {
- Scanner keyboard = new Scanner( System.in ) ;
- SpanishCalendar a_spanish_calendar = new SpanishCalendar( 2015, 11 );
- a_spanish_calendar.print() ;
- EnglishCalendar calendar_to_print = new EnglishCalendar( 2015, 12 ) ;
- calendar_to_print.print() ;
- String user_selection = "????" ;
- System.out.print("\n This program prints calendars. Please, selectfrom"+ "\n the following
- menu by typing in a letter. ") ;
- while ( user_selection.charAt( 0 ) != 'e' )
- {
- System.out.print("\n\n p Print previous calendar."+ "\n n Print next calendar."+ "\n s Switch
- to Spanish calendars."+ "\n y Print next year's first month"+ "\n e Exit the program.\n\n " ) ;
- user_selection = keyboard.nextLine() ;
- if ( user_selection.charAt( 0 ) == 'p' )
- {
- calendar_to_print.decrement_calendar_month() ;
- calendar_to_print.print() ;
- }
- if ( user_selection.charAt( 0 ) == 'y' )
- {
- calendar_to_print.first_month() ;
- calendar_to_print.print() ;
- }
- else if ( user_selection.charAt( 0 ) == 'n' )
- {
- calendar_to_print.increment_calendar_month() ;
- calendar_to_print.print() ;
- }
- else if ( user_selection.charAt( 0 ) == 's' )
- {
- // We'll take the calendar year and month from the old calendar
- // object and use them to create a SpanishCalendar object.
- calendar_to_print = new
- SpanishCalendar(calendar_to_print.get_calendar_year(),calendar_to_print.get_calendar_mon
- th() ) ;
- calendar_to_print.print() ;
- }
- }
- }
- }
- OUTPUT:
- ON PRESSING “ p ” :
- ON PRESSING “ n ” :
- ON PRESSING “ s ” :
- ON PRESSING “ y ” :
- EXPERIMENT NO 8
- 16BCE0281
- BELAL AHMED
- 1. Write a Java Program to implement the bank operation using Multiple Inheritance
- (Bank Interface,
- Customer & Account classes).
- a) Crete a Interface Bank having data members like rate of interest, no_of_years and
- use method
- show( )
- b) Crete a class Customer with the data members customer_name, customer_id and
- method
- display( )
- c) Create another class Account having data members account_no, account_balance
- and method
- interest( ) which Extends the Customer class and implemented Bank interface
- d) Write the tester class with the name Account details. Pass the Custome Name,
- ID,Account
- Numner and Balance through main method. Display the Rate of interest for 3 years @
- 12% and
- display the output as given below.
- Customer Name = XYZ
- Customer Id = 12345678
- Account No. = 9876543
- Account Balance = 5000.0
- Interest = 1800.0
- CODE:
- interface Bank
- {
- float rate = 12.0f;
- int no_of_years=3;
- void show();
- }
- class Customer
- {
- String cust_name;
- int cust_id;
- Customer(String n, int i)
- {
- cust_name = n;
- cust_id = i;
- }
- void display()
- {
- System.out.println("Customer Name = "+cust_name); System.out.println("Customer Id =
- "+cust_id);
- }
- }
- class Account extends Customer implements Bank
- {
- int acc_no;
- float acc_bal;
- Account(String n, int b, int x, float y)
- {
- super(n, b);
- acc_no=x;
- acc_bal=y;}
- public void show()
- {
- display();
- System.out.println("Account No. = "+acc_no); System.out.println("Account Balance =
- "+acc_bal);
- }
- void interest()
- {
- show();
- float intr = (rate*acc_bal*no_of_years)/100;
- System.out.println("Interest = "+intr);
- }
- }
- public class Acc
- {
- public static void main (String[] args)
- {
- Account ac = new Account("Nimesh Poddar", 12345678, 9876543, 10000); ac.interest();
- }
- }
- OUTPUT:
- QUESTION 2:
- Write a java program to create interface named taxcalculation. Use methods like
- information ( ), show ( ) and also maintain the Tax rate as 20%. Implement this
- interface in employee class to calculate the tax of the employee based on the number of
- days worked in the company.Get the input from the user for the Salary (per/day) and
- No. of days worked.
- CODE:
- import java.io.*;
- import java.lang.System;
- interface taxcalc
- {
- public void info();
- public void show();
- public final double tax=20;
- }
- class employee implements taxcalc
- {
- int salary;
- double no_days;
- employee(int a, double b)
- {
- salary=a;
- no_days=b;
- }
- public void info()
- {
- double rate;
- java.util.Date date=new java.util.Date();
- rate=((salary*no_days)/tax);
- System.out.println("Tax calculated as :"+"("+date+")"+rate);
- }
- public void show()
- {
- System.out.println("thank you for using tax app.");
- }
- }
- public class office
- {
- public static void main(String[] args) throws IOException
- {
- BufferedReader b;
- b=new BufferedReader(new InputStreamReader(System.in));
- System.out.println("Enter the salary:");
- int sal=Integer.parseInt(b.readLine());
- System.out.println("Enter the number of days worked:");
- double nod=Double.parseDouble(b.readLine());
- employee obj=new employee(sal, nod); obj.info();
- obj.show();
- }
- }
- OUTPUT:
- QUESTION 3:
- Create a package named VITRational. It should have a class YYRational (YY is your
- initial). The class should have method to simplify the rational number. The input
- received from the user is of the form a/b as string and it is passed as argument to the
- method Simplify(string). This method has to display the simplified output.(eg:simplify(
- 15/20) - >output:3/4). Write a java application program which make use of the above
- method.
- CODE:
- package VITrational;
- import java.lang.*;
- public class NPrational
- {
- int num, den, i, small;
- String n, d, ans;
- String spl[]=new String[2];
- public NPrational()
- {
- num=0;
- den=0;
- }
- public void simplify(String a)
- {
- spl=a.split("/");
- num=Integer.parseInt(spl[0]);
- den=Integer.parseInt(spl[1]);
- small=((num<den)?num:den);
- for(i=num;i>=1;i--)
- {
- if(num%i==0 && den%i==0)
- {
- num/=i;
- den/=i;
- }
- }
- n=Integer.toString(num);
- d=Integer.toString(den);
- ans=n.concat("/");
- ans=ans.concat(d);
- System.out.println("Simplified answer is : "+ans);
- }
- }
- import VITrational.*;
- import java.io.*;
- import java.util.*;
- class rat
- {
- public static void main(String args[])
- {
- String a;
- NPrational r=new NPrational(); Scanner s=new Scanner(System.in);
- System.out.println("Enter rational number (a/b) : ");
- a=s.next();
- r.simplify(a);
- }
- }
- OUTPUT:
- 4. Develop an Java application using hierarchy concept that accepts several types of
- orders: store orders,
- warehouse orders, and online orders. The following requirements have to be
- implemented:
- a. All orders share some common properties like order ID, a list of products, date/time
- created, and amount.
- b. Some types of orders may contain their own specific properties (store ID, store
- representative for store orders,warehouse ID for warehouse order and coupoun code
- for online order)
- c. Business logic for ordervalidation and processing varies by type, Order cancellation
- logic is universal across all types.
- CODE:
- import java.io.*;
- import java.lang.*;
- public interface Order
- {
- public int orderId=1;
- public String date="23.10.2018";//Date/time creation of the product
- public double amount=8.0;
- }
- import java.io.*;
- import java.lang.*;
- public class WarehouseOrder implements Order
- {
- public int warehouseId;
- public void WarehouseOrder()
- {
- warehouseId=0;
- }
- public void displayOrder()
- {
- System.out.println("Your order id is "+orderId);
- System.out.println("Your order date is "+date);
- System.out.println("Your total amount is "+amount);
- System.out.println("Your warehouse ID is"+warehouseId);
- }
- public static void main(String args[])throws IOException
- {
- WarehouseOrder obj = new WarehouseOrder();
- obj.WarehouseOrder();
- obj.displayOrder();
- }
- }
- import java.io.*;
- import java.lang.*;
- public class StoreOrder implements Order
- {
- public int storeId;
- public String representative;
- public void StoreOrder()
- {
- storeId=927;
- representative="Hello";
- }
- public void displayOrder()
- {
- System.out.println("Your order id is "+orderId);
- System.out.println("Your order date is "+date);
- System.out.println("Your total amount is "+amount);
- System.out.println("Your store representative is"+representative);
- }
- public static void main(String args[])throws IOException
- {
- StoreOrder obj = new StoreOrder();
- obj.StoreOrder();
- obj.displayOrder();
- }
- }
- import java.io.*;
- import java.lang.*;
- public class OnlineOrder implements Order
- {
- public String couponcode;
- public void OnlineOrder()
- {
- couponcode="Nun";
- }
- public void displayOrder()
- { System.out.println("Your order id is "+orderId);
- System.out.println("Your order date is "+date);
- System.out.println("Your total amount is "+amount);
- System.out.println("Your coupon code is "+couponcode);
- }
- public static void main(String args[])throws IOException
- { OnlineOrder obj = new OnlineOrder();
- obj.OnlineOrder();
- obj.displayOrder();
- }
- }
- OUTPUT:
- EXPERIMENT NO 9
- 16BCE0281
- BELAL AHMED
- CODE:
- index.jsp
- <%@page contentType="text/html" pageEncoding="UTF-8"%>
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Shopping Cart - Login</title>
- <style type="text/css">
- <!--
- .container {
- height: 700px;
- width: 900px;
- margin:auto;
- }
- .headbanner {
- float: left;
- height: 80px;
- width: 900px;
- vertical-align:middle;
- background-color:#FFCC00;
- }
- .container .headbanner h1 {
- font-family: Verdana, Geneva, sans-serif;
- color: #CC3300;
- }
- .mycontent {
- float: left;
- height: 500px;
- width: 900px;
- }
- .myfooter {
- float: left;
- height: 100px;
- width: 900px;
- border-top-width:3px;
- border-top-style:solid;
- border-top-color:#FFCC00;
- }
- .container .myfooter h3 {
- font-family: Verdana, Geneva, sans-serif;
- font-size: 12px;
- color:#CC3300;
- }
- .space {
- float: left;
- height: 35px;
- width: 900px;
- font-size: 24px;
- font-family: Verdana, Geneva, sans-serif;
- padding-top:15px;
- }
- .formcontent {
- float: left;
- height: 200px;
- width: 900px;
- }
- .formtext {
- color:#CC3300;
- font-family:Verdana, Geneva, sans-serif;
- }
- -->
- </style>
- </head>
- <body style="margin:0; padding:0">
- <div class="container">
- <div class="headbanner">
- <h1 style="display:inline">
- <center>
- <img src="img/shopping.png" />[My Shopping Cart]
- </center>
- </h1>
- </div>
- <div class="mycontent">
- <div class="space"><span><a class="formtext">Login</a></span></div>
- <div class="formcontent">
- <form action="loginval" method="post">
- <table>
- <tr>
- <td class="formtext">Username :</td>
- <td><input id="name" name="uname" type="text" size="30" /></td><td><a
- style="font-size: 10px; font-family:lucida sans; color: darkgray">[Any name]</a></td>
- </tr>
- <tr>
- <td class="formtext">Password :</td>
- <td><input id="pas" name="pass" type="password" size="30" /></td><td><a
- style="font-size: 10px; font-family:lucida sans; color: darkgray">[Pass = 1234]</a></td>
- </tr>
- <tr>
- <td><input type="submit" value="Submit"/></td>
- </tr>
- </table>
- </form>
- </div>
- </div>
- <div class="myfooter">
- <h3 style="font-weight:normal; padding-left:10px">© BELAL AHMED </h3>
- </div>
- </div>
- </body>
- </html>
- checkout.jsp
- <%@page import="java.util.ArrayList"%>
- <%@ page import="classes.item" %>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Shopping Cart - Check out</title>
- <style type="text/css">
- <!--
- .container {
- height: 700px;
- width: 900px;
- margin:auto;
- }
- .headbanner {
- float: left;
- height: 80px;
- width: 900px;
- vertical-align:middle;
- background-color:#FFCC00;
- }
- .container .headbanner h1 {
- font-family: Verdana, Geneva, sans-serif;
- color: #CC3300;
- }
- .mycontent {
- float: left;
- height: 500px;
- width: 900px;
- }
- .myfooter {
- float: left;
- height: 100px;
- width: 900px;
- border-top-width:3px;
- border-top-style:solid;
- border-top-color:#FFCC00;
- }
- .container .myfooter h3 {
- font-family: Verdana, Geneva, sans-serif;
- font-size: 12px;
- color:#CC3300;
- }
- td{
- font-family:Verdana, Geneva, sans-serif;
- font-weight:normal;
- font-size:14px;
- }
- -->
- </style>
- </head>
- <body style="margin:0; padding:0">
- <form action="purchase" method="post">
- <%
- ArrayList it_list = (ArrayList) session.getAttribute("itemlist");
- %>
- <div class="container">
- <div class="headbanner">
- <h1 style="display:inline"><center>
- <img src="img/shopping.png" />[My Shopping Cart]
- </center></h1>
- </div>
- <div class="mycontent">
- <a style="color:#CC3300; font-family:Verdana, Geneva, sans-serif; font-size:20px;
- font-weight:bold">Checkout My Cart</a><br />
- <table width="500px">
- <%
- for (int i = 0; i < it_list.size(); i++) {
- classes.item itm = (item) it_list.get(i);
- %>
- <tr>
- <td><%out.print(itm.name);%></td>
- <td><%out.print(itm.price);%></td>
- </tr>
- <% }%>
- <tr>
- <td style="font-weight:bold">My Total</td><td style="fontweight:bold">$[<%out.print(session.getAttribute("total"));%>]</td>
- </tr>
- <tr>
- <td><input type="submit" value="Purchase" /></td>
- </tr>
- <tr>
- <td><img src="img/paywith.png" width="210" height="80" /></td></tr>
- </table>
- </div>
- <div class="myfooter">
- <h3 style="font-weight:normal; padding-left:10px">© BELAL AHMED </h3>
- </div>
- </div>
- </form>
- </body>
- </html>
- success.jsp
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Shopping Cart - Success</title>
- <style type="text/css">
- <!--
- .container {
- height: 700px;
- width: 900px;
- margin:auto;
- }
- .headbanner {
- float: left;
- height: 80px;
- width: 900px;
- vertical-align:middle;
- background-color:#FFCC00;
- }
- .container .headbanner h1 {
- font-family: Verdana, Geneva, sans-serif;
- color: #CC3300;
- }
- .mycontent {
- float: left;
- height: 400px;
- width: 900px;
- padding-top:100px;
- }
- .myfooter {
- float: left;
- height: 100px;
- width: 900px;
- border-top-width:3px;
- border-top-style:solid;
- border-top-color:#FFCC00;
- }
- .container .myfooter h3 {
- font-family: Verdana, Geneva, sans-serif;
- font-size: 12px;
- color:#CC3300;
- }
- .container .mycontent h3 {
- font-family: Verdana, Geneva, sans-serif;
- }
- -->
- </style>
- </head>
- <body style="margin:0; padding:0">
- <%if(session.getAttribute("purch")!="true"){response.sendRedirect("index.jsp");
- } %>
- <form action="shop.jsp" method="post">
- <div class="container">
- <div class="headbanner">
- <h1 style="display:inline"><center>
- <img src="img/shopping.png" />[My Shopping Cart]
- </center></h1>
- </div>
- <div class="mycontent">
- <h3 align="center" style="color:#CC3300;">Purchase has been succeeded! Thank
- You.<br /><input type="submit" value="Ok" /></h3>
- </div>
- <div class="myfooter">
- <h3 style="font-weight:normal; padding-left:10px">© BELAL AHMED</h3>
- </div>
- </div>
- </form>
- </body>
- </html>
- shop.jsp
- <%@page import="java.util.ArrayList"%>
- <%@ page import="classes.item" %>
- <!DOCTYPE html>
- <html>
- <head>
- <%
- String user = (String) session.getAttribute("user");
- if (user == null) {
- response.sendRedirect("index.jsp");
- }
- %>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Shopping Cart - Shop</title>
- <style type="text/css">
- <!--
- .container {
- height: 850px;
- width: 900px;
- margin:auto;
- }
- .headbanner {
- float: left;
- height: 80px;
- width: 900px;
- vertical-align:middle;
- background-color:#FFCC00;
- }
- .container .headbanner h1 {
- font-family: Verdana, Geneva, sans-serif;
- color: #CC3300;
- }
- .mycontent {
- float: left;
- height: 650px;
- width: 900px;
- }
- .myfooter {
- float: left;
- height: 100px;
- width: 900px;
- border-top-width:3px;
- border-top-style:solid;
- border-top-color:#FFCC00;
- }
- .container .myfooter h3 {
- font-family: Verdana, Geneva, sans-serif;
- font-size: 12px;
- color:#CC3300;
- }
- .cartof {
- float: left;
- height: 25px;
- width: 900px;
- font-family: Verdana, Geneva, sans-serif;
- font-weight: bold;
- padding-top:5px;
- }
- .cartcontent {
- float: left;
- height: 200px;
- width: 900px;
- background-color:#FFFFC2;
- border-width:1px;
- border-style:solid;
- border-color:#FFCC00;
- }
- .prod1 {
- float: left;
- height: 100px;
- width: 900px;
- border-bottom-width:1px;
- border-bottom-style:solid;
- border-bottom-color:#FFCC00;
- }
- td{
- padding-left:5px;
- color:#900;
- font-family:Verdana, Geneva, sans-serif;
- }
- .items {
- float: left;
- height: auto;
- width: 900px;
- }
- tr.border_bottom td {
- border-bottom-width:1px;
- border-bottom-style:solid;
- border-bottom-color:#FFCC00;
- height:100px;
- }
- .myitems {
- float: left;
- height: 200px;
- width: 600px;
- border-right-width:1px;
- border-right-style:solid;
- border-right-color:#FFCC00;
- overflow: auto;
- }
- th{
- color:#FFF;
- font-family:Verdana, Geneva, sans-serif;
- font-weight:normal;
- background-color:#900;
- }
- .total {
- float: left;
- height: 180px;
- width: 285px;
- font-family: Verdana, Geneva, sans-serif;
- font-size: 24px;
- font-weight: bold;
- padding-top:20px;
- padding-left:10px;
- }
- -->
- </style>
- </head>
- <body style="margin:0; padding:0">
- <div class="container">
- <form action="requesthandle" method="post">
- <div class="headbanner">
- <h1 style="display:inline">
- <center>
- <img src="img/shopping.png" />[My Shopping Cart]
- </center>
- </h1>
- </div>
- <div class="mycontent">
- <div class="cartof">
- <center><a style="color: #CC3300;">Cart Of [<%
- out.print(session.getAttribute("user"));%>]<input name="logout" type="submit"
- value="Logout"></input></a></center>
- </div>
- <div class="cartcontent">
- <div class="myitems">
- <table width="600px" cellpadding="0" cellspacing="0">
- <tr>
- <th>#id</th>
- <th>Item</th>
- <th>Price</th>
- <th>Action</th>
- </tr>
- <%if (session.getAttribute("itemlist") != null) {
- ArrayList mycart = (ArrayList) session.getAttribute("itemlist");
- for (int i = 0; i < mycart.size(); i++) {
- item it = (item) mycart.get(i);
- %>
- <tr>
- <td align="center"><%out.print(i);%></td>
- <td align="center"><% out.print(it.name);%></td>
- <td align="center"><% out.print(it.price);%></td>
- <td align="center"><input name="del" type="submit" value="Delete"
- onclick="this.value=<%out.print(i);%>"></input></td>
- </tr>
- <%}
- }
- %>
- </table>
- </div>
- <div class="total">
- <a>My Total : $[<% out.print(session.getAttribute("total"));%>]</a><br />
- <a style="font-size:14px">Total Qty: [<% ArrayList il = (ArrayList)
- session.getAttribute("itemlist");
- out.print(il.size());%>]</a><br />
- <input name="chkout" type="submit" value="Checkout" />
- </div>
- </div>
- <div class="items">
- <table width="900px">
- <tr class="border_bottom">
- <td>#1</td>
- <td>Sunglass</td>
- <td>Ray-Ban, Dark Purple Sunglass with the Casing</td>
- <td>$34</td>
- <td><img src="img/sunglass.jpg" width="90" height="90" /></td>
- <td><input name="addtocart1" type="submit" value="Add to Cart" /></td>
- </tr>
- <tr class="border_bottom">
- <td>#2</td>
- <td>Wrist Watch</td>
- <td>Quartz, Men's wrist watch, Black</td>
- <td>$66</td>
- <td><img src="img/watch.jpg" width="90" height="90" /></td>
- <td><input name="addtocart2" type="submit" value="Add to Cart" /></td>
- </tr>
- <tr class="border_bottom">
- <td>#3</td>
- <td>Camera</td>
- <td>Lumix, 16x Digital Camera</td>
- <td>$167</td>
- <td><img src="img/camera.jpg" width="90" height="90" /></td>
- <td><input name="addtocart3" type="submit" value="Add to Cart" /></td>
- </tr>
- <tr class="border_bottom">
- <td>#4</td>
- <td>Shoes</td>
- <td>Bettans, 60 Leather Shoes, Brown</td>
- <td>$23</td>
- <td><img src="img/shoes.jpg" width="90" height="90" /></td>
- <td><input name="addtocart4" type="submit" value="Add to Cart" /></td>
- </tr>
- </table>
- </div>
- </div>
- <div class="myfooter">
- <h3 style="font-weight:normal; padding-left:10px">© </h3>
- </div>
- </form>
- </div>
- </body>
- </html>
- error.jsp
- <%@page contentType="text/html" pageEncoding="UTF-8"%>
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title>JSP Page</title>
- </head>
- <body>
- <h1>Hello World!</h1>
- </body>
- </html>
- OUTPUT:
- abc
- © 2006 - 2018 Paste2.org.
- Follow paste2.org on Twitter
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement