0% found this document useful (0 votes)
14 views

Fall 2022 - CS506 - 2

Fall 2022_CS506

Uploaded by

Rahmeen Shahbaz
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Fall 2022 - CS506 - 2

Fall 2022_CS506

Uploaded by

Rahmeen Shahbaz
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

Assignment No.

02
Total Marks: 20
Semester: Fall 2022
Compiler Construction CS506 Due Date: 25th Jan, 2023

Instructions:

Please read the following instructions carefully before submitting assignment. It should be clear that
your assignment will not get any credit if:

 The assignment is submitted after due date.


 The submitted assignment does not open or file is corrupt.
 Assignment is copied (partial or full) from any source (websites, forums, students, etc.)
Strict action will be taken in this regard.
 The assignment format is other than doc/docx.

Objectives:

The objective of this assignment is to provide hands-on experience of Java Programming concepts
including:

 Servlet Basics
 Process Request
 Member Functions and main function

For any assignment related query, contact at [email protected]

Covered Lectures: Assignment no.2 is from 23-35 lectures.

Software (s) Used to develop Assignment


Note: Use any tool for coding but copy/past that code in word format (doc, docx) file.
Submit word format (doc, docx) file of complete code including both:
1. FirstServlet ProcessRequest() method
2. SecondServelet ProcessRequest() method
(No multiple or zip files allowed)
Problem Statement: Marks 20

Write the code for two Java Servlets (processRequest() methods only) in such a way that user enter
his/her “bill_amount” and submit the form to the FirstServlet. FirstServlet calculates "tax" on that
amount and forwards the request (using Request Dispatcher method) to SecondServlet that displays
the amount and calculated tax.

Formula to calculate Tax: bill_amount * 10 / 100

URL pattern of second Servlet: /secondservlet

Note: No need to write complete code, just write the code in processRequest() method of each
Servlet, as shown below.

Solution Sample:

FirstServlet processRequest() method:

protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws


ServletException, IOException {

// write your code here.

SecondServlet processRequest() method:

protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws


ServletException, IOException {

// write your code here.

BEST OF LUCK

You might also like