Distance in meters

mar
Distance in meters
Posted in : Java Beginners

October 9, 2009 at 2:09 PM

Hi Friend,

Try the following code:

import java.util.*;
public class ConvertMeter{
public void showKilometers(double meters){
double kilometers = meters * 0.001;
System.out.println(meters+" meters is "+kilometers+" kms");
}
public void showInches(double meters){
double inches = meters * 39.37;
System.out.println(meters+" meters is "+inches+" inches");
}
public void showFeet(double meters){
double feet = meters * 3.281;
System.out.println(meters+" meters is "+feet+" feet");
}
System.out.print("Enter a distance in meters: ");
Scanner scan=new Scanner(System.in);
double m=scan.nextDouble();
boolean quit = false;

do{
System.out.println();
System.out.println("1. Convert to kilometers");
System.out.println("2. Convert to inches");
System.out.println("3. Convert to feet");
System.out.println("4. Quit the program");
System.out.println();
case 1:
showKilometers(m);
break;
case 2:
showInches(m);
break;
case 3:
showFeet(m);
break;
case 4:
quit = true;
System.out.println("Bye!");
break;
default:
System.out.println("Invalid Entry!");
}
}

while (!quit);

}
public static void main(String[]args){
ConvertMeter convert=new ConvertMeter();
}
}

Thanks

Distance in meters - Java Beginners
a distance in meters. The program will then present the following menu of selections... should not accept negative numbers for the distance in meters. ? If the user...?s input is shown in bold. Enter a distance in meters: 500 1. Convert
Distance conversion - Java Beginners
(){ System.out.print("Enter a distance in meters: "); Scanner scan=new Scanner(System.in...Distance conversion  Write an application that reads a distance... the distance to kilometres, feet and inches, according to the user?s selection
class distance
class distance  class distance-integer data member km1,km2,km3,m1,m2,m3. run()-to input the two distance and add them in the third. display()-to display the total distance. display the constructor if required
Version of com.quigley>meters dependency
List of Version of com.quigley>meters dependency
Edit Distance
Edit Distance  I want java programming ask from user input two string and the program find the edit distance between two strings and find table and optimal solution using GUI
Another distance conversion - Java Beginners
[]){ System.out.print("Enter distance in meters : "); BufferedReader br = new BufferedReader(new...); } double value=Double.parseDouble(distance); System.out.println(distance+" meters...Another distance conversion  Write an application that reads
Convert Feet To Meters
Convert Feet To Meters       In this section, you will learn to convert Feet to Meters. The following program helps you in converting Feet to Meters.  Code
Delhi to Udaipur by road distance
Delhi to Udaipur by road distance  delhi to udaipur by road distance
Convert Inches To Meters
Convert Inches To Meters       In this section, you will learn to Inches To Meters. The following program helps you in converting Inches To Meters.  Code Description
Maven Dependency meters >> 0.0.1
Convert 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
Road distance using Java - Java Beginners
Road distance using Java  Dear All i am calculating the straight line distance between two latlong points using the simple mathematical formula but i need the Real Road Driving Distance // protected double distance(double pX
Hill stations near Delhi distance
Hill stations near Delhi distance   Hi, Can any one tell the distances of the Hill stations near Delhi? Thanks
Version of com.shopizer>shopizer-shipping-distance-processor dependency
List of Version of com.shopizer>shopizer-shipping-distance-processor dependency
Distance learning business management courses are on high demand today.... But those students should not worry as many institutions have started distance... for the future and skilled workforce. Distance learning business management courses
Hill Stations near Delhi distance
Distance of Major Hill Stations From Delhi  In this page we have listed all the Hill Stations near Delhi with their distance from central Delhi... and northeastern India. List of Hill Stations near Delhi with distance Sr
VoIP Long Distance
VoIP Long Distance          VoIP Designing a Long-Distance Network The long-distance Voice over IP (VoIP) network solution is a set of network design
GUI and how to convert a distance - Java Beginners
application that can be is used to convert a distance unit in miles into its...=new JTextField(20); t5=new JTextField(20); l1=new JLabel("Enter distance...){ String value=t1.getText(); double distance=Double.parseDouble(value
How can i display the distance of a line drawing randomly?
How can i display the distance of a line drawing randomly?  How can i display the distance of a line drawing randomly
Maven Dependency shopizer-shipping-distance-processor >> 2.0.3
loop to input multiple points to calculate final distance and speed
loop to input multiple points to calculate final distance and speed  ...; private double distance; public Travel() { time=0; distance=0... getDistance() { return distance; } public static void main (String[] args
What is Differential GPS?
the accuracy to within two meters of the actual position for moving objects... two receivers within a distance of a few hundred kilometers receive have the same amount of errors, as they have traveled the same amount of distance
Golden Triangle Tour - Enchanting Golden Triangle Tour
The best part of Golden Triangle Tour is that all these three cities are just four to five hours driving distance from each other
How GPS Measures Distances
of an object using distance measurements from at least three satellites. Let us now examine how distance from the satellites is calculated. The Principle... obtain the distance from city A to city B as 240 miles by multiplying the speed of 80
Techniques to Improve GPS Accuracy
technology developed so far, with accuracy levels of within 4-20 meters or so... of readings to within 1-3 meters of the object, as compared to the 4-20 meters
Kilometers per Liter to Miles per Gallon
: 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
What is UWB?
What is UWB?       UWB (Ultra Wideband) is a radio frequency platform that is used in the wireless device for communicating  within a short distance with  high accuracy
A Brief Introduction to Travel
A Brief Introduction to Travel In simple words, Travel is the moving of objects or people between two geographical locations of relative distance. At times Introduction to Travel can also include movements between different
VoIP Termination
Protocol (VoIP) Termination provides reliable long distance connectivity for carriers... distance VoIP access to residential and commercial customers. There are few... network to the PSTN for terminating domestic long distance calls * Nationwide
VoIP Companies
VoIP Companies          VoIP Services providers and Enterprise VoIP first revolutionized long distance exchange services. Almost overnight, consumers could
java beginners
: d is the distance in meters, g is 9.8, and t is the amount of time, in seconds... return the distance, in meters, that the object has fallen during that time..., the following formula can be used to determine the distance of the object falls