GTU OOP Program - 3
3. Write a program that reads a number in meters, converts it into feet, and displays the result.
Note: 1 foot is 0.3048 meter approximately.
- class Practical_03 {
- public static void main(String args[]) {
- // create a constant value
- final double METER_per_FOOT = 0.3048;
- // setting the value of length in feet
- double len_feet = 50;
- // converting feet into meter
- double len_meter = len_feet * METER_per_FOOT;
- // printing the values
- System.out.println("value of " + len_feet + " feets in meter is : " + len_meter + " m");
- }
- }
Output
Comments