Write a program titledYourLastName_Program2a which will read in data from the standard input stream (System.in)representinglength in miles, feet, and inches.The program will then convert the values into meters(using 3.3ft per 1m) and print out the new total value (rounded to the nearest tenth).*Hint: convert all user input to feet, then convert to meters using the given conversion factor.For example:A typical run and the expected output of your program would look like this(bolded areas represent the users input):% java Diaz_Program2aEnter miles: 1Enter feet: 26Enter inches: 131 mile(s), 26 feet, 13 inche(s) converts to 1608.2meter(s).Write a second program titled YourLastName_Program2b which then does the reverse conversion (using 1 m per 3.3ft with the results rounded to the nearest tenth).A typical run and the expected output of your program would look like this (bolded areas represent the users input): *Hint: convert to feet using the given conversion factor, then convert from total feet to miles, feet, and inches.% java Diaz_Program2bEnter meters: 12341234meters(s) converts to 0mile(s), 4072feet, 2.4inch(es).Use and submit the following test cases captured in a file by using the command % script Program2.out:
Program2a
1 mile, 100 feet, 10 inches25 miles, 460 feet, 6 inches0 miles, 1578 feet, 100 inches
Program2b
173 meters3661 meters1020 metersWhat to turn in: Soft copy of the results using the script command Soft copy of the programs (the .java file submitted via Blackboard)
5/5 – (4 votes)
Reviews
There are no reviews yet.