Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions? | Software Development
 

Convert Meters To Miles

In this section, you will learn to convert Meters To Miles. The following program helps you in converting Meters To Miles.

Convert Meters To Miles

                         

In this section, you will learn to convert Meters To Miles. The following program helps you in converting Meters To Miles. 

Code Description:

To convert Meters To Miles we have used a formula "meter = * 0.00062137119;". The compiler will ask to enter the number of Meters from the keyboard due to the method  "
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));". Here we have taken meter to be of type Int. To avoid loss of precession we have cast the output to be in double.

Here is the code of the program:

import java.io.*;
import java.util.*;

class MetersToMiles{
  public static void main (String[] args)throws Exception{
    // 1 meters = 0.00062137119 miles;
    BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
    System.out.print("Enter the Meters:");
    int meter = Integer.parseInt(bf.readLine());
    double miles = meter * 0.00062137119;
    System.out.println("Miles: " + miles);
  }
}

Output of the program:

C:\unique>javac MetersToMiles.java

C:\unique>java MetersToMiles
Enter the Meters:1
Miles: 6.2137119E-4

C:\unique>java MetersToMiles
Enter the Meters:4
Miles: 0.00248548476

C:\unique>

Download this example.

                         

» View all related tutorials
Related Tags: c convert io help this program to learn ram ear e il section in converting m ps pro s is

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
 
Tell A Friend
Your Friend Name

 

 
Recently Viewed
Software Solutions
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.