Professional Documents
Culture Documents
Digital Assignment 4: Saumitra Pathak 19bce2411 Labda3 L23+L24 1-12-2021
Digital Assignment 4: Saumitra Pathak 19bce2411 Labda3 L23+L24 1-12-2021
19BCE2411
Lab DA 3
L23+L24
1-12-2021
DIGITAL ASSIGNMENT 4
NAME : SAUMITRA PATHAK
Q1
Write an HTML and PHP code to get the students details like Name, Reg No, Course,
Course Code, Marks for 5 Subjects (CAT1, CAT2, DA1, DA2 and QUIZ)
Verify if the CAT marks are greater than 30 and less than zero, show an alert
message "Invalid Marks".
If anyone of the subject mark is less than 15. Display the message via browser as
"Slow Learner and Do the Extra Assignment work".
Calculate the Internal Marks by converting CAT 1 & 2 Marks to 15 each and Add
DA1, DA2, and QUIZ marks.
Display the details in the table format including average marks.
Sort and display the student details based on the Internal Mark.
Calculate the CGPA and Display the details.
Style the webpage using CSS and align the text in the centre using margin. Use
Different font types.
HTML
<!DOCTYPE html>
<html>
<head>
<title>Lab Assessment 4</title>
<style type="text/css">
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background-color: #333;
color: #fff700;
font-family: 'Montserrat', sans-serif;
}
form {
width: 80%;
margin: 50px auto;
Saumitra Pathak
19BCE2411
Lab DA 3
L23+L24
1-12-2021
}
form label{
font-size: 1.15rem;
}
form .btn{
background-color: crimson;
color: #333;
padding: 1rem 3rem;
font-size: 1.5rem;
margin-bottom: 15px;
border-color: #fff700;
font-family: 'Montserrat', sans-serif;
}
form .btn:hover{
background-color: #fff700;
color: #333;
border-color: crimson;
}
form .submission{
width: 7%;
margin: 0 auto;
}
table{
width: 70%;
margin: 50px auto;
border: 2px solid crimson;
border-collapse: collapse;
}
tr, td{
padding: 20px;
border: 2px solid crimson;
}
</style>
<link rel="preconnect"
href="https://fonts.googleapis.com">
Saumitra Pathak
19BCE2411
Lab DA 3
L23+L24
1-12-2021
<br />
<br />
<div class="names2">
<label>Subject 1 Marks:</label>
<input
type="text"
name="c1marks1"
placeholder="Enter CAT 1 Marks"
required
/>
<input
type="text"
name="c2marks1"
placeholder="Enter CAT 2 Marks"
required
/>
<input
type="text"
name="d1marks1"
placeholder="Enter DA 1 Marks"
required
/>
<input
type="text"
name="d2marks1"
placeholder="Enter DA 2 Marks"
required
/>
<input
type="text"
name="qmarks1"
placeholder="Enter QUIZ Marks"
required
/>
</div>
<br />
Saumitra Pathak
19BCE2411
Lab DA 3
L23+L24
1-12-2021
<br />
<div class="names2">
<label>Subject 2 Marks:</label>
<input
type="text"
name="c1marks2"
placeholder="Enter CAT 1 Marks"
required
/>
<input
type="text"
name="c2marks2"
placeholder="Enter CAT 2 Marks"
required
/>
<input
type="text"
name="d1marks2"
placeholder="Enter DA 1 Marks"
required
/>
<input
type="text"
name="d2marks2"
placeholder="Enter DA 2 Marks"
required
/>
<input
type="text"
name="qmarks2"
placeholder="Enter QUIZ Marks"
required
/>
</div>
<br />
<br />
Saumitra Pathak
19BCE2411
Lab DA 3
L23+L24
1-12-2021
<div class="names2">
<label>Subject 3 Marks:</label>
<input
type="text"
name="c1marks3"
placeholder="Enter CAT 1 Marks"
required
/>
<input
type="text"
name="c2marks3"
placeholder="Enter CAT 2 Marks"
required
/>
<input
type="text"
name="d1marks3"
placeholder="Enter DA 1 Marks"
required
/>
<input
type="text"
name="d2marks3"
placeholder="Enter DA 2 Marks"
required
/>
<input
type="text"
name="qmarks3"
placeholder="Enter QUIZ Marks"
required
/>
</div>
<br />
<br />
<div class="names2">
Saumitra Pathak
19BCE2411
Lab DA 3
L23+L24
1-12-2021
<label>Subject 4 Marks:</label>
<input
type="text"
name="c1marks4"
placeholder="Enter CAT 1 Marks"
required
/>
<input
type="text"
name="c2marks4"
placeholder="Enter CAT 2 Marks"
required
/>
<input
type="text"
name="d1marks4"
placeholder="Enter DA 1 Marks"
required
/>
<input
type="text"
name="d2marks4"
placeholder="Enter DA 2 Marks"
required
/>
<input
type="text"
name="qmarks4"
placeholder="Enter QUIZ Marks"
required
/>
</div>
<br />
<br />
<div class="names2">
<label>Subject 5 Marks:</label>
Saumitra Pathak
19BCE2411
Lab DA 3
L23+L24
1-12-2021
<input
type="text"
name="c1marks5"
placeholder="Enter CAT 1 Marks"
required
/>
<input
type="text"
name="c2marks5"
placeholder="Enter CAT 2 Marks"
required
/>
<input
type="text"
name="d1marks5"
placeholder="Enter DA 1 Marks"
required
/>
<input
type="text"
name="d2marks5"
placeholder="Enter DA 2 Marks"
required
/>
<input
type="text"
name="qmarks5"
placeholder="Enter QUIZ Marks"
required
/>
</div>
<br />
<br />
<br />
<div class="submission">
Saumitra Pathak
19BCE2411
Lab DA 3
L23+L24
1-12-2021
$stream=$_POST['stream'];
$a1=$_POST['c1marks1'];
$a2=$_POST['c1marks2'];
$a3=$_POST['c1marks3'];
$a4=$_POST['c1marks4'];
$a5=$_POST['c1marks5'];
$b1=$_POST['c2marks1'];
$b2=$_POST['c2marks2'];
$b3=$_POST['c2marks3'];
$b4=$_POST['c2marks4'];
$b5=$_POST['c2marks5'];
$c1=$_POST['d1marks1'];
$c2=$_POST['d1marks2'];
$c3=$_POST['d1marks3'];
$c4=$_POST['d1marks4'];
$c5=$_POST['d1marks5'];
$d1=$_POST['d2marks1'];
$d2=$_POST['d2marks2'];
$d3=$_POST['d2marks3'];
$d4=$_POST['d2marks4'];
$d5=$_POST['d2marks5'];
$e1=$_POST['qmarks1'];
$e2=$_POST['qmarks2'];
$e3=$_POST['qmarks3'];
$e4=$_POST['qmarks4'];
$e5=$_POST['qmarks5'];
Saumitra Pathak
19BCE2411
Lab DA 3
L23+L24
1-12-2021
function changeMarks($num1) {
$sum = ($num1/30)*100;
$sum = (15*$sum)/100;
return $sum;
}
function changeMarks2($num2) {
$num = ($num2/60)*100;
$num = (100*$num)/1000;
return $num;
}
if($a1<0 || $a1>30) echo '
<script>
alert("Invalid Marks");
</script>
'; if($a2<0 || $a2>30) echo '
<script>
alert("Invalid Marks");
</script>
'; if($a3<0 || $a3>30) echo '
<script>
alert("Invalid Marks");
</script>
'; if($a4<0 || $a4>30) echo '
<script>
alert("Invalid Marks");
</script>
'; if($a5<0 || $a5>30) echo '
<script>
alert("Invalid Marks");
</script>
'; if($b1<0 || $b1>30) echo '
<script>
alert("Invalid Marks");
</script>
'; if($b2<0 || $b2>30) echo '
<script>
Saumitra Pathak
19BCE2411
Lab DA 3
L23+L24
1-12-2021
alert("Invalid Marks");
</script>
'; if($b3<0 || $b3>30) echo '
<script>
alert("Invalid Marks");
</script>
'; if($b4<0 || $b4>30) echo '
<script>
alert("Invalid Marks");
</script>
'; if($b5<0 || $b5>30) echo '
<script>
alert("Invalid Marks");
</script>
';
if($a1<15 || $a2<15 || $a3<15 || $a4<15 || $a5<15 ||
$b1<15 || $b2<15 || $b3<15 || $b4<15 || $b5<15){
echo '
<script>
alert("Slow Learner and Do the Extra Assignment
work");
</script>';
}
$avg1=($a1+$a2+$a3+$a4+$a5)/5;
$avg2=($b1+$b2+$b3+$b4+$b5)/5;
$a1=changeMarks($a1);
$a2=changeMarks($a2);
$a3=changeMarks($a3);
$a4=changeMarks($a4);
$a5=changeMarks($a5);
$b1=changeMarks($b1);
$b2=changeMarks($b2);
$b3=changeMarks($b3);
$b4=changeMarks($b4);
$b5=changeMarks($b5);
$sum1 = $a1+$b1+$c1+$d1+$e1;
Saumitra Pathak
19BCE2411
Lab DA 3
L23+L24
1-12-2021
$sum2 = $a2+$b2+$c2+$d2+$e2;
$sum3 = $a3+$b3+$c3+$d3+$e3;
$sum4 = $a4+$b4+$c4+$d4+$e4;
$sum5 = $a5+$b5+$c5+$d5+$e5;
$sum1 = changeMarks2($sum1);
$sum2 = changeMarks2($sum2);
$sum3 = changeMarks2($sum3);
$sum4 = changeMarks2($sum4);
$sum5 = changeMarks2($sum5);
$cgpa = ($sum1 + $sum2 + $sum3 + $sum4 + $sum5)/5;
$cgpa = 0.95*($cgpa);
echo "<br />";
echo "
<table>
"; echo "
<tr>
<td>Name</td>
<td>".$name."</td>
</tr>
"; echo "
<tr>
<td>Reg. No.</td>
<td>".$regno."</td>
</tr>
"; echo "
<tr>
<td>Branch Name</td>
<td>".$stream."</td>
</tr>
"; echo "
<tr>
<td>Average Marks for CAT 1</td>
<td>".$avg1."</td>
</tr>
"; echo "
<tr>
Saumitra Pathak
19BCE2411
Lab DA 3
L23+L24
1-12-2021
SCREENSHOTS OF PROOF
Saumitra Pathak
19BCE2411
Lab DA 3
L23+L24
1-12-2021
OUTPUT
Saumitra Pathak
19BCE2411
Lab DA 3
L23+L24
1-12-2021
Saumitra Pathak
19BCE2411
Lab DA 3
L23+L24
1-12-2021