Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 31-07-2009
Member
 
Join Date: Jul 2009
Posts: 1,113
kilometers per liter to mpg program.

Hi,

I am making a program in java to convert the kilometers per liter (kpl) to miles per gallon (mpg).
I need some help with this. Should I use Swing component for GUI?

What should be the correct way to present the page & to show reverse conversion too.

Thanks in advance.
Visala28
Reply With Quote
  #2  
Old 31-07-2009
Member
 
Join Date: May 2008
Posts: 32
Re: kilometers per liter to mpg program.

1 KPL = 2.84 MPG (imperial)
1 MPG = 0.35 KPL

Now u can code your program both the ways. Use swing for better representation or you can just do it with simple html too. or applet or also can be done with JSP for saving purpose.
Reply With Quote
  #3  
Old 31-07-2009
Member
 
Join Date: May 2008
Posts: 20
Re: kilometers per liter to mpg program.

To convert kpl to mpg multiply your kilometers per liter(kpl) with 2.353
Eg. 10 kpl = 2.353 * 10 = 23.53 mpg
Reply With Quote
  #4  
Old 31-07-2009
Member
 
Join Date: May 2008
Posts: 22
Re: kilometers per liter to mpg program.

Kilometers per Liter to Miles per Gallon


Kilometers per liter : The distance traveled by a vehicle which is running on gasoline or diesel fuel in a kilometer.

Miles per Gallon: The distance traveled by a vehicle which is running on gasoline or diesel fuel in a mile.

mpg = kmpl * Conversion_factor.
Value of the conversion factor is 2.352145 which is constant

code:

Code:
<html>
<head>
<title>ConversionTable of Kilometers perLiter and Miles per Gallon </title>
</head>
<body>
<FONT SIZE="6" COLOR="#CC99FF">ConversionTable of Kilometers
perLiter and Miles per Gallon</FONT>
<table border="1" bgcolor="#CCCCFF">
<tr><td><b>Kilometers per Liter</b></td><td><b>Miles per Gallon</b></td><tr>
<%

double kmpl=0.0;
double mpg=0.0;
final double CONVERSION_FACTOR = 2.352145;

for ( kmpl = 5; kmpl < 25;kmpl++){

		mpg = kmpl * CONVERSION_FACTOR;
	%>	
<tr>
<td><%=kmpl%>
</td>

<td><%=mpg%>
</td>
</tr>
<%    
}
%>

</table>

</body>
</html>
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "kilometers per liter to mpg program."
Thread Thread Starter Forum Replies Last Post
Windows 7: Program Files vs Program Files(x86) Script Operating Systems 5 01-06-2011 06:03 PM
?This program is using by another program? error message in windows 7 SchuRacer Operating Systems 3 28-01-2011 01:57 PM
Windows DEP program continuously closes the MSN mail program Charioteer Windows Software 4 19-10-2010 11:52 AM
Running a program under WOW64 on a program X64 Pratyush Software Development 2 08-04-2009 09:51 PM
End Program ccSvcHst Program not responding Leena Operating Systems 6 29-08-2008 01:58 PM


All times are GMT +5.5. The time now is 05:47 AM.