Java Data Types: Exercises, Practice, Solution

Last update on September 04 2018 07:06:35 (UTC/GMT +8 hours)

Java Data Types Exercises [10 exercises with solution]

[An editor is available at the bottom of the page to write and execute the scripts.]

1. Write a Java program to convert temperature from Fahrenheit to Celsius degree. Go to the editorTest Data
Input a degree in Fahrenheit: 212Expected Output:
212.0 degree Fahrenheit is equal to 100.0 in Celsius

2. Write a Java program that reads a number in inches, converts it to meters. Go to the editor
Note: One inch is 0.0254 meter.Test Data
Input a value for inch: 1000Expected Output :
1000.0 inch is 25.4 meters

7. Write a Java program to takes the user for a distance (in meters) and the time was taken (as three numbers: hours, minutes, seconds), and display the speed, in meters per second, kilometers per hour and miles per hour (hint: 1 mile = 1609 meters). Go to the editor

9. Write a Java program that accepts two integers from the user and then prints the sum, the difference, the product, the average, the distance (the difference between integer), the maximum (the larger of the two integers), the minimum (smaller of the two integers). Go to the editor