A simple program in Java that will display a table of distance equivalent of miles to kilometers and vice versa.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.


My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.


My mobile number here in the Philippines is 09173084360. My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.


Here in Bacolod City, Negros Occidental I also accepting computer repair, networking and Arduino Project development at a very affordable price.
My programming website is http://www.jakerpomperada.blogspot.com


I am also a book author you can purchase my books on computer programming and information technology in the following links below.

Home

https://www.unlimitedbooksph.com/
Thank you very much for your help and support.

Sample Program Output

Program Listing

distance.java

package test;

public class distance {
public static void main(String[] args) {

final double KILOMETERS_PER_MILE = 1.609; System.out.print("\n\n");     

System.out.println("\tMiles To Kilometers Distance Table in Java"); System.out.print("\n\n");       

// Display table header

System.out.println( "Miles      Kilometers   |   Kilometers     Miles     ");
// Create and display tables

for (int m = 1, k = 11; m <= 10 && k <= 20; m++, k += 1) { System.out.printf( "%-11d%-10.3f", m, (m * KILOMETERS_PER_MILE)); System.out.print("   |   ");

System.out.printf( "%-15d%-6.3f\n", k, (k / KILOMETERS_PER_MILE)); }
}
}

Leave a Reply

Your email address will not be published. Required fields are marked *