PROJECT ON CURRENCY
CONVERTER
By R.Shreeja(160609737039) L.Deepthi Sree(160609737010) Branch: IT
ABSTRACT
In finance,an exchange rate between two currencies is the rate at which one currency will be exchanged for another. It is a useful tool which gives us the value of certain amount of one currency to be converted in to a different currency. It is also regarded as the value of one countrys currency in terms of another currency. In this project we are going to display a web window in which currency options are given and the conversion value is displayed in the next window.
TABLE OF CONTENTS
Introduction Algorithm Flowchart Designing Coding Conclusion
INTRODUCTION
Currency converter is a tool used to convert one countrys currency to another. In this project by the knowledge of usage of currency converter a program is designed in java language. In this Currency Converter application, it is going to display a web page where u can choose to display the converter or the exchange rate of one currency with all other currencies in the form of table. In the converter u are given a choice to choose two currency names from the list of currency names displayed.
ALGORITHM
Step1: Start Step2: Enter the amount value Step3: Select the currency from and to Step4: Click on the convert button Step5: The value will be displayed Step6: Exit
FLOW CHART
Start Input given is amount value and currency names are selected from the options Click on convert Given amount value is
+
Output value will be positive
Output value will be negative
0
Output will be zero Stop
DESIGNING
We are using different concepts like HTML for creating web page SERVLETS for creating dynamic pages and for displaying output JDBC for establishing the connection with the database. This code is implemented by using TOMCAT server.
CODING
Introduction Page <html> <body> <center> <h1>WELCOME TO CURRENCY CONVERTER</h1><br><br> <p>If u want to see currency convertion click on CONVERTER or<br> If u want to see convertion of one currency into different currencies click on TABLES</p> <a href="C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\currencyconverterapp\exp.html">CONVERTER</a> <br><br> <a href="C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\currencyconverterapp\tableoptions.html">TABLES< /a> </center> </body> </html>
TABLES OPTION IS SELECTED
If option tables is selected & for selection of currency name
<html> <body> <center> <p>Select one currency name to see conversion of this in other currencies</p> <br><br> <a href="C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\currencyconverterapp\usd.html">American Dollar (USD)</a><br> <a href="C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\currencyconverterapp\aud.html">Australian Dollar (AUD)</a><br> <a href="C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\currencyconverterapp\gbp.html">British Pound (GBP)</a><br>
<a href="C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\currencyconverterapp\cad.html">Canadian Dollar (CAD)</a><br> <a href="C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\currencyconverterapp\cny.html">Chinese Yuan (CNY)</a><br> <a href="C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\currencyconverterapp\eur.html">Euro (EUR)</a><br> <a href="C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\currencyconverterapp\inr.html">Indian Rupee (INR</a><br> <a href="C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\currencyconverterapp\myr.html">Malaysian Ringgit (MYR)</a><br> <a href="C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\currencyconverterapp\nzd.html">New Zealand Dollar (NZD)</a><br> <a href="C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\currencyconverterapp\chf.html">Swiss Franc (CHF)</a><br> </center> </body> </html>
IF CONVERTER IS SELECTED
<html> <center> <h1>CURRENCY CONVERTER</h1> <form action="TestJDBC.java"method="get"> AMOUNT<input type="text" name="amount"><br><br> FROM CURRENCY<select name="fromcurrency"> <option value="USD">American Dollar (USD)</option> <option value="AUD">Australian Dollar (AUD)</option> <option value="GBP">British Pound (GBP)</option> <option value="CAD">Canadian Dollar (CAD)</option> <option value="CNY">Chinese Yuan (CNY)</option> <option value="EUR">Euro (EUR)</option> <option value="INR">Indian Rupee (INR)</option> <option value="MYR">Malaysian Ringgit (MYR)</option> <option value="NZD">New Zealand Dollar (NZD)</option> <option value="CHF">Swiss Franc (CHF)</option> </select><br><br>
TO CURRENCY<select name="tocurrency"> <option value="USD">American Dollar (USD)</option> <option value="AUD">Australian Dollar (AUD)</option> <option value="GBP">British Pound (GBP)</option> <option value="CAD">Canadian Dollar (CAD)</option> <option value="CNY">Chinese Yuan (CNY)</option> <option value="EUR">Euro (EUR)</option> <option value="INR">Indian Rupee (INR)</option> <option value="MYR">Malaysian Ringgit (MYR)</option> <option value="NZD">New Zealand Dollar (NZD)</option> <option value="CHF">Swiss Franc (CHF)</option> </select><br><br> <input type="submit" name="click" value="convert"> </form> </center> </html>
FOR DISPLAYING OF TABLE
<html> <center> <br><br><br><br><br><br><br><br><br> <table border="1"> <tr> <th> </th> <th>USD</th> <th>AUD</th> <th>GBP</th> <th>CAD</th> <th>CNY</th> <th>EUR</th> <th>INR</th> <th>MYR</th> <th>NZD</th> <th>CHF</th> </tr>
<tr> <td>1AUD </td> <td>1.02876 </td><td>1.0000 </td><td>0.64047 </td><td>1.04436 </td><td>6.52590 </td> <td>0.74745 </td><td>51.4731</td><td>3.22548 </td><td>1.30789 </td><td>0.92633 </td> </tr> <tr> <td>Inverse </td> <td>0.97205 </td><td>1.0000 </td><td>1056135 </td><td>0.95753 </td><td>0.153236</td> <td>1.33789 </td><td>0.01943 </td><td>0.310031 </td><td>0.76459 </td><td>1.0795 </td> </tr> </table> </center> </html>
DATABASE CONNECTION
import java.io.*; import java.sql.*; import javax.servlet.*; import javax.servlet.http.*; public class Test extends HttpServlet { Connection conn; public void init() throws ServletException { try { Class.forName("oracle.jdbc.driver.OracleDriver"); conn=DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1: 1521","hr","demo"); }
catch(ClassNotFoundException e) { System.out.println(e); } catch(SQLException e) { System.out.println("Unable to connect"); } } public void doGet(HttpServletRequest request,HttpServletResponse response)throws ServletException,IOException { response.setContentType("text/html"); PrintWriter pw=response.getWriter(); try {
float amt=request.getParameter("t1"); float v1=0,v3; String fc, tc; fc=request.getParameter("fromcurrency"); tc=request.getParameter("tocurrency"); pw.println("<HTML>"); pw.println("<BODY>"); pw.println("<CENTER>"); Statement st=conn.createStatement(); ResultSet rs=st.executeQuery("SELECT VALUE1 FROM TABLE1 WHERE CURRENCY1='"+fc+"'AND CURRENCY2='"+tc+"'"); if(rs.next()) { v1=rs.getFloat(3); v3=v1*amt; pw.println("<h2>value is:"+v3+"</h2>"); pw.println("<h3>1"+fc+"="+v1+tc+"</h3>"); }
else pw.println("<h2>record not found</h2>"); pw.println("</CENTER>"); pw.println("</BODY>"); pw.println("</HTML>"); pw.close(); rs.close(); st.close(); conn.close(); } catch(SQLException e) { System.out.println(e); } } }
SCREEN SHOTS
IF USER SELECTS TABLES
FORMAT OF TABLE
IF USER SELECTS CONVERTER
CONCLUSION
Therefore , currency converter is developed and is used for knowing the currencys value. It can be further developed by including more currency options, and by shown currency value tables for the user.