Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your assignment is to implement a simple web service that lets users convert an amount from one currency to another, for example from USD to

Your assignment is to implement a simple web service that lets users convert an amount from one currency to another, for example from USD to EUR. The interface should consist of two text fields, “Amount” and “Rate,” and a submit button, “Convert!” If you want to convert an amount from one currency to another, we input the amount in the “Amount” text field and presses the “Convert!” button. The service should reply with a new web page that displays the result of the conversion. The service should remember which exchange rate is being used for conversion, initially 1.0. If the user wants to change the exchange rate he inputs a new rate in the “Rate” text field and the amount to be converted in the “Amount” field. The new rate should be remembered for future conversion when the “Rate” field is left empty.

Write your servlet in a file named Converter.java.

You should implement one doGet method and one doPost method.
In the doGet method, write code that produces an HTML page. Let the “action” attribute of the

tag have the value “/converter/servlet/Converter”, pointing out the servlet you are implementing. Let the “method” attribute have the value “post”.


In the doPost method, write code that retrieves the values entered into the text fields of the HTML form. Process the information accordingly and produce a suitable HTML page as a reply.

Use an attribute in the Converter class to store the current exchange rate.

Compile your servlet.

Test your servlet on your web browser. Remember to start the Tomcat server first!

Step by Step Solution

3.31 Rating (163 Votes )

There are 3 Steps involved in it

Step: 1

Converterhtml Currency Converter Amount Rate Converterjava impo... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Principles of Economics

Authors: Tyler Cowen, Alex Tabarrok

3rd edition

1429278390, 978-1429278416, 1429278412, 978-1429278393

More Books

Students also viewed these General Management questions

Question

Vol = 3 . 1 4 5 9 r = 2 3 write the java expression

Answered: 1 week ago

Question

$1.25 is 3/4 % of what amount?

Answered: 1 week ago