Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / Java Programming Help C) Write a program to convert from kilometers (km) to miles or miles to kilometers

Java Programming Help C) Write a program to convert from kilometers (km) to miles or miles to kilometers

Computer Science

Java Programming Help

C)

  1. Write a program to convert from kilometers (km) to miles or miles to kilometers. The program should have a menu in main that lets the user select which one they want to do.  It should then ask for either miles or kilometers based on their choice.  Next, perform a method to calculate the miles, or a separate method to calculate kilometers.  The result should be shown in the calculating method.  Use JOptionPane to get the choice, the kilometers or miles, and display the results.  The calculation for km to miles is miles = km * .6214.  The calculation for miles to km is km = miles / .6214.

    Validate for the correct choice and that the miles or kilometers entered are greater than zero.
    • Hints/Tips:
      • Use String.format to format your message with the numeric fields. Show 2 decimals.
      • The methods do not return any values
      • It took me about 20 minutes
    • Rubric
      • Doesn’t use methods to generate results -5 (no credit for this part of the assignment)
      • Doesn’t calculate correctly -1
      • Doesn’t format the numbers in the output -.5
      • Doesn’t have two separate method (calc miles and calc kms) -1
      • Doesn’t use JOptionPane -1
      • Doesn’t validate for correct choice -.5
      • Doesn’t validate the miles or kilometers -.5

Option 1

Low Cost Option
Download this past answer in few clicks

11.99 USD

PURCHASE SOLUTION

Already member?


Option 2

Custom new solution created by our subject matter experts

GET A QUOTE