You are on page 1of 19

Nama : Putri Qurrota Aini

NIM : 061640831793
Kelas : 5 MIB

OPERATOR PERHITUNGAN PADA JSP

A. Source code index.jsp


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Tugas Perhitungan</title>
</head>

<body bgcolor="Navajowhite">
<center><h1><font color="blue" face="comic sans ms">OPERATOR
PERHITUNGAN</font></h1>

<table bgcolor="white" border="2px">


<tr>
<td align="center" width="130px" height="60px">
<form action ="operator dasar.jsp" method="get">
<input type="submit" style="background-color:Lightskyblue; font-
family:times new roman; width:200px; height:60px;" value="OPERATOR DASAR">
</form>
</td>
</tr>

<tr bgcolor="white">
<td align="center" width="130px" height="60px">
<form action ="persegi panjang.jsp" method="get">
<input type="submit" style="background-color:lightgreen; font-
family:times new roman; width:200px; height:60px;" value="PERSEGI PANJANG">
</form>
</tr>

<tr bgcolor="white">
<td align="center" width="130px" height="60px">
<form action ="lingkaran.jsp" method="get">
<input type="submit" style="background-color:lightsalmon; font-
family:times new roman; width:200px; height:60px;" value="LINGKARAN">
</form>
</td>
</tr>
</table>
</center>
</body>
</html>

1
B. Output Index

2
I. OPERATOR DASAR

A. Source Code pada file “operator dasar.jsp”


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title> Operator Dasar </title>
</head>

<body bgcolor="Lightskyblue">
<center><h1><font color="orangered" face="comic sans ms">Operator
Dasar</font></h1>

<table bgcolor=#F0E68C border="2px">


<font color="orange" size="7" face="times new roman">
<tr bgcolor="orange"><th>Penjumlahan</th><th>Pengurangan</th>
</tr>

<tr bgcolor=#F0E68C>
<td align="center" width="130px" height="40">
<form action ="tambah.jsp" method="get">
Angka 1 : <input name="a" type="text" style="background-color:#FAF0E6 ;
text-align:center; width:100px; height:20px; border:1px"><br>
Angka 2 : <input name="b" type="text" style="background-color:#FAF0E6 ;
text-align:center; width:100px; height:20px; border:1px"><br><br>
<input type="submit" style="background-color:darkorange; font-weight:bold;
font-family:times new roman; font-size:16px; width:70px; height:30px;" value="+">
</form><br>
</td>
<td align="center" width="130px" height="40">
<form action ="kurang.jsp" method="get">
Angka 1 : <input name="a" type="text" style="background-color:#FAF0E6 ;
text-align:center;width:100px; height:20px; border:1px"><br>
Angka 2 : <input name="b" type="text" style="background-color:#FAF0E6 ;
text-align:center; width:100px; height:20px; border:1px"><br><br>
<input type="submit" style="background-color:darkorange; font-weight:bold;
font-family:times new roman; font-size:16px; width:70px; height:30px;" value="-">
</form><br>
</td>
</tr>

<tr bgcolor="orange"><th>Perkalian</th><th>Pembagian</th>
</tr>

<tr bgcolor=#F0E68C>

3
<td align="center" width="130px" height="40">
<form action ="kali.jsp" method="get">
Angka 1 : <input name="a" type="text" style="background-color:#FAF0E6 ;
text-align:center; width:100px; height:20px; border:1px"><br>
Angka 2 : <input name="b" type="text" style="background-color:#FAF0E6 ;
text-align:center; width:100px; height:20px; border:1px"><br><br>
<input type="submit" style="background-color:darkorange; font-weight:bold;
font-family:times new roman; font-size:16px; width:70px; height:30px;" value="*">
</form><br>
</td>
<td align="center" width="130px" height="40">
<form action ="bagi.jsp" method="get">
Angka 1 : <input name="a" type="text" style="background-color:#FAF0E6 ;
text-align:center; width:100px; height:20px; border:1px"><br>
Angka 2 : <input name="b" type="text" style="background-color:#FAF0E6 ;
text-align:center; width:100px; height:20px; border:1px"><br><br>
<input type="submit" style="background-color:darkorange; font-weight:bold;
font-family:times new roman; font-size:16px; width:70px; height:30px;" value="/">
</form><br>
</td>
</tr>

<tr bgcolor="orange"><th>Modulus</th></tr>

<tr bgcolor=#F0E68C>
<td align="center" width="130px" height="40">
<form action ="mod.jsp" method="get">
Angka 1 : <input name="a" type="text" style="background-color:#FAF0E6 ;
text-align:center; width:100px; height:20px; border:1px"><br>
Angka 2 : <input name="b" type="text" style="background-color:#FAF0E6 ;
text-align:center; width:100px; height:20px; border:1px"><br><br>
<input type="submit" style="background-color:darkorange; font-weight:bold;
font-family:times new roman; font-size:16px; width:70px; height:30px;" value="Mod">
</form><br>
</td>
<td align="center" width="130px" height="40">
<form action ="index.jsp" method="get">
<input type="submit" style="background-color:darkorange; font-
weight:bold; font-family:times new roman; font-size:13px; width:70px; height:50px;"
value="HOME">
</form><br>
</td>
</table>
</center>
</body>
</html>

4
B. Tampilan dari operator dasar.jsp

Tampilan saat mengisi data:

5
 Operator Penjumlahan
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Penjumlahan</title>
</head>
<body bgcolor="Lightskyblue">
<center><h1><font color="orangered" face="comic sans
ms">Penjumlahan</font></h1>
<%
int a = Integer.parseInt(request.getParameter("a"));
int b = Integer.parseInt(request.getParameter("b"));
int c = a + b;
out.print("Nilai A adalah "+a);
out.print("<br>");
out.print("Nilai B adalah "+b);
out.print("<br>");
out.print("Hasil Penjumlahan adalah "+c);
%>

<br><br>
<table>
<tr>
<td align="center" width="120px" height="40">
<form action ="operator dasar.jsp" method="get">
<input type="submit" style="background-color:darkorange; font-
weight:bold; font-family:times new roman; font-size:13px; width:60px; height:30px;"
value="BACK">
</form>
</td>
<td align="center" width="120px" height="40">
<form action ="index.jsp" method="get">
<input type="submit" style="background-color:darkorange; font-
weight:bold; font-family:times new roman; font-size:13px; width:60px; height:30px;"
value="HOME">
</form>
</td>
</tr>
</table>
</center>
</body>
</html>

6
Tampilan hasil penjumlahan:

 Operator Pengurangan
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Pengurangan</title>
</head>
<body bgcolor="Lightskyblue">
<center><h1><font color="orangered" face="comic sans
ms">Pengurangan</font></h1>
<%
int a = Integer.parseInt(request.getParameter("a"));
int b = Integer.parseInt(request.getParameter("b"));
int c = a - b;
out.print("Nilai A adalah "+a);
out.print("<br>");
out.print("Nilai B adalah "+b);
out.print("<br>");
out.print("Hasil Pengurangan adalah "+c);
%>

<br><br>
<table>
<tr>
<td align="center" width="120px" height="40">
<form action ="operator dasar.jsp" method="get">
<input type="submit" style="background-color:darkorange; font-
weight:bold; font-family:times new roman; font-size:13px; width:60px; height:30px;"
value="BACK">
</form>
</td>
<td align="center" width="120px" height="40">
<form action ="index.jsp" method="get">
<input type="submit" style="background-color:darkorange; font-
weight:bold; font-family:times new roman; font-size:13px; width:60px; height:30px;"
value="HOME">
</form>
</td>
</tr>

7
</table>
</center>
</body>
</html>

Tampilan hasil pengurangan:

 Operator Perkalian
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Perkalian</title>
</head>
<body bgcolor="Lightskyblue">
<center><h1><font color="orangered" face="comic sans
ms">Perkalian</font></h1>
<%
int a = Integer.parseInt(request.getParameter("a"));
int b = Integer.parseInt(request.getParameter("b"));
int c = a * b;
out.print("Nilai A adalah "+a);
out.print("<br>");
out.print("Nilai B adalah "+b);
out.print("<br>");
out.print("Hasil Perkalian adalah "+c);
%>

<br><br>
<table>
<tr>
<td align="center" width="120px" height="40">
<form action ="operator dasar.jsp" method="get">
<input type="submit" style="background-color:darkorange; font-
weight:bold; font-family:times new roman; font-size:13px; width:60px; height:30px;"
value="BACK">
</form>
</td>
<td align="center" width="120px" height="40">
<form action ="index.jsp" method="get">

8
<input type="submit" style="background-color:darkorange; font-
weight:bold; font-family:times new roman; font-size:13px; width:60px; height:30px;"
value="HOME">
</form>
</td>
</tr>
</table>
</center>
</body>
</html>

Tampilan hasil perkalian:

 Operator Pembagian
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Pembagian</title>
</head>
<body bgcolor="Lightskyblue">
<center><h1><font color="orangered" face="comic sans
ms">Pembagian</font></h1>
<%
int a = Integer.parseInt(request.getParameter("a"));
int b = Integer.parseInt(request.getParameter("b"));
int c = a / b;
out.print("Nilai A adalah "+a);
out.print("<br>");
out.print("Nilai B adalah "+b);
out.print("<br>");
out.print("Hasil Pembagian adalah "+c);
%>

<br><br>
<table>
<tr>
<td align="center" width="120px" height="40">
<form action ="operator dasar.jsp" method="get">

9
<input type="submit" style="background-color:darkorange; font-
weight:bold; font-family:times new roman; font-size:13px; width:60px; height:30px;"
value="BACK">
</form>
</td>
<td align="center" width="120px" height="40">
<form action ="index.jsp" method="get">
<input type="submit" style="background-color:darkorange; font-
weight:bold; font-family:times new roman; font-size:13px; width:60px; height:30px;"
value="HOME">
</form>
</td>
</tr>
</table>
</center>
</body>
</html>

Tampilan hasil pembagian:

 Sisa Hasil Bagi (Modulus)


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Modulus</title>
</head>
<body bgcolor="Lightskyblue">
<center><h1><font color="orangered" face="comic sans ms">Sisa Hasil
Bagi</font></h1>
<%
int a = Integer.parseInt(request.getParameter("a"));
int b = Integer.parseInt(request.getParameter("b"));
int c = a % b;
out.print("Nilai A adalah "+a);
out.print("<br>");
out.print("Nilai B adalah "+b);
out.print("<br>");
out.print("Hasil Modulus adalah "+c);
%>

10
<br><br>
<table>
<tr>
<td align="center" width="120px" height="40">
<form action ="operator dasar.jsp" method="get">
<input type="submit" style="background-color:darkorange; font-
weight:bold; font-family:times new roman; font-size:13px; width:60px; height:30px;"
value="BACK">
</form>
</td>
<td align="center" width="120px" height="40">
<form action ="index.jsp" method="get">
<input type="submit" style="background-color:darkorange; font-
weight:bold; font-family:times new roman; font-size:13px; width:60px; height:30px;"
value="HOME">
</form>
</td>
</tr>
</table>
</center>
</body>
</html>

Tampilan hasil modulus:

11
II. PERSEGI PANJANG

A. Source Code pada file “persegi panjang.jsp”


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title> Persegi Panjang </title>
</head>

<body bgcolor="lightgreen">
<center><h1><font color="orangered" face="comic sans ms">Persegi
Panjang</font></h1>

<table bgcolor=#F0E68C border="2px">


<font color="orange" size="7" face="times new roman">
<tr bgcolor="orange"><th>Luas</th><th>Keliling</th>
</tr>

<tr bgcolor=#F0E68C>
<td align="center" width="130px" height="40">
<form action ="luasPP.jsp" method="get">
Panjang : <input name="p" type="text" style="background-color:#FAF0E6 ;
text-align:center; width:100px; height:20px; border:1px"><br>
Lebar : <input name="l" type="text" style="background-color:#FAF0E6 ;
text-align:center; width:100px; height:20px; border:1px"><br><br>
<input type="submit" style="background-color:darkorange; font-weight:bold;
font-family:times new roman; font-size:16px; width:70px; height:30px;" value="Luas">
</form>
</td>
<td align="center" width="130px" height="40">
<form action ="kurang.jsp" method="get">
Panjang : <input name="p" type="text" style="background-color:#FAF0E6 ;
text-align:center;width:100px; height:20px; border:1px"><br>
Lebar : <input name="l" type="text" style="background-color:#FAF0E6 ;
text-align:center; width:100px; height:20px; border:1px"><br><br>
<input type="submit" style="background-color:darkorange; font-weight:bold;
font-family:times new roman; font-size:16px; width:70px; height:30px;"
value="Keliling">
</form>
</td>
</tr>
</table>

<br>
<form action ="index.jsp" method="get">

12
<input type="submit" style="background-color:darkorange; font-weight:bold;
font-family:times new roman; font-size:13px; width:70px; height:40px;"
value="HOME">
</form>
</center>
</body>
</html>

B. Tampilan output dari “persegi panjang.jsp”

Tampilan saat mengisi data:

 Luas Persegi Panjang


Kode untuk menghitung luas persegi panjang “luasPP.jsp”
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Luas Persegi Panjang</title>
</head>
<body bgcolor="lightgreen">
<center><h1><font color="orangered" face="comic sans ms">Luas Persegi
Panjang</font></h1>
<%
int p = Integer.parseInt(request.getParameter("p"));
int l = Integer.parseInt(request.getParameter("l"));
int L = p * l;

13
out.print("Panjang adalah "+p);
out.print("<br>");
out.print("Lebar adalah "+l);
out.print("<br>");
out.print("Luas Persegi Panjang adalah "+L);
%>

<br><br>
<table>
<tr>
<td align="center" width="120px" height="40">
<form action ="persegi panjang.jsp" method="get">
<input type="submit" style="background-color:darkorange; font-
weight:bold; font-family:times new roman; font-size:13px; width:60px; height:30px;"
value="BACK">
</form>
</td>
<td align="center" width="120px" height="40">
<form action ="index.jsp" method="get">
<input type="submit" style="background-color:darkorange; font-
weight:bold; font-family:times new roman; font-size:13px; width:60px; height:30px;"
value="HOME">
</form>
</td>
</tr>
</table>
</center>
</body>
</html>

Tampilan output dari luas persegi panjang “luasPP.jsp”.

 Keliling Persegi Panjang


Kode untuk menghitung keliling persegi panjang “kelilingPP.jsp”
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Keliling Persegi Panjang</title>
</head>
<body bgcolor="lightgreen">
14
<center><h1><font color="orangered" face="comic sans ms">Keliling Persegi
Panjang</font></h1>
<%
int p = Integer.parseInt(request.getParameter("p"));
int l = Integer.parseInt(request.getParameter("l"));
int L = 2 * p * l;
out.print("Panjang adalah "+p);
out.print("<br>");
out.print("Lebar adalah "+l);
out.print("<br>");
out.print("Keliling Persegi Panjang adalah "+L);
%>

<br><br>
<table>
<tr>
<td align="center" width="120px" height="40">
<form action ="persegi panjang.jsp" method="get">
<input type="submit" style="background-color:darkorange; font-
weight:bold; font-family:times new roman; font-size:13px; width:60px; height:30px;"
value="BACK">
</form>
</td>
<td align="center" width="120px" height="40">
<form action ="index.jsp" method="get">
<input type="submit" style="background-color:darkorange; font-
weight:bold; font-family:times new roman; font-size:13px; width:60px; height:30px;"
value="HOME">
</form>
</td>
</tr>
</table>
</center>
</body>
</html>

Tampilan output dari keliling persegi panjang “kelilingPP.jsp”.

15
III. LINGKARAN

A. Source Code pada file “lingkaran.jsp”


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title> Lingkaran </title>
</head>

<body bgcolor="lightsalmon">
<center><h1><font color="brown" face="comic sans ms">Lingkaran</font></h1>

<table bgcolor=#F0E68C border="2px">


<font color="orange" size="7" face="times new roman">
<tr bgcolor="orange"><th>Luas</th><th>Keliling</th>
</tr>

<tr bgcolor=#F0E68C>
<td align="center" width="130px" height="40">
<form action ="luasL.jsp" method="get">
Jari-jari : <input name="r" type="text" style="background-color:#FAF0E6
; text-align:center; width:100px; height:20px; border:1px"><br><br>
<input type="submit" style="background-color:darkorange; font-
weight:bold; font-family:times new roman; font-size:16px; width:70px; height:30px;"
value="Luas">
</form>
</td>
<td align="center" width="130px" height="40">
<form action ="kelilingL.jsp" method="get">
Jari-jari : <input name="r" type="text" style="background-color:#FAF0E6
; text-align:center; width:100px; height:20px; border:1px"><br><br>
<input type="submit" style="background-color:darkorange; font-
weight:bold; font-family:times new roman; font-size:16px; width:70px; height:30px;"
value="Keliling">
</form>
</td>
</tr>
</table>

<br>
<form action ="index.jsp" method="get">
<input type="submit" style="background-color:darkorange; font-weight:bold;
font-family:times new roman; font-size:13px; width:70px; height:40px;"
value="HOME">
</form>

16
</center>
</body>
</html>

B. Tampilan output dari “lingkaran.jsp”

Tampilan saat mengisi data:

 Luas Lingkaran
Kode untuk menghitung luas lingkaran “luasL.jsp”
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Luas Lingkaran</title>
</head>
<body bgcolor="lightsalmon">
<center><h1><font color="red" face="comic sans ms">Luas
Lingkaran</font></h1>
<%
int r = Integer.parseInt(request.getParameter("r"));
double phi = 3.14;
double L = phi * r * r;
out.print("Jari-jari adalah "+r);
out.print("<br>");
out.print("Luas Lingkaran adalah "+L);
%>

17
<br><br>
<table>
<tr>
<td align="center" width="120px" height="40">
<form action ="lingkaran.jsp" method="get">
<input type="submit" style="background-color:darkorange; font-
weight:bold; font-family:times new roman; font-size:13px; width:60px; height:30px;"
value="BACK">
</form>
</td>
<td align="center" width="120px" height="40">
<form action ="index.jsp" method="get">
<input type="submit" style="background-color:darkorange; font-
weight:bold; font-family:times new roman; font-size:13px; width:60px; height:30px;"
value="HOME">
</form>
</td>
</tr>
</table>
</center>
</body>
</html>

Tampilan output dari luas lingkaran “luasL.jsp”.

 Keliling Lingkaran
Kode untuk menghitung keliling lingkaran “kelilingL.jsp”
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Keliling Lingkaran</title>
</head>
<body bgcolor="lightsalmon">
<center><h1><font color="red" face="comic sans ms">Keliling
Lingkaran</font></h1>
<%
int r = Integer.parseInt(request.getParameter("r"));
double phi = 3.14;
double K = 2 * phi* r;
out.print("Jari-jari adalah "+r);

18
out.print("<br>");
out.print("Keliling Lingkaran adalah "+K);
%>

<br><br>
<table>
<tr>
<td align="center" width="120px" height="40">
<form action ="lingkaran.jsp" method="get">
<input type="submit" style="background-color:darkorange; font-
weight:bold; font-family:times new roman; font-size:13px; width:60px;
height:30px;" value="BACK">
</form>
</td>
<td align="center" width="120px" height="40">
<form action ="index.jsp" method="get">
<input type="submit" style="background-color:darkorange; font-
weight:bold; font-family:times new roman; font-size:13px; width:60px;
height:30px;" value="HOME">
</form>
</td>
</tr>
</table>
</center>
</body>
</html>

Tampilan output dari keliling lingkaran “kelilingL.jsp”.

19

You might also like