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.

  1. class Practical_03 {
  2. public static void main(String args[]) {
  3.  
  4. // create a constant value
  5. final double METER_per_FOOT = 0.3048;
  6.  
  7. // setting the value of length in feet
  8. double len_feet = 50;
  9.  
  10. // converting feet into meter
  11. double len_meter = len_feet * METER_per_FOOT;
  12.  
  13. // printing the values
  14. System.out.println("value of " + len_feet + " feets in meter is : " + len_meter + " m");
  15. }
  16. }
Output
cse gtu, gtu study material for computer engineering students gujarat technological university oop lab manual solution

Comments

YouTube

Popular posts from this blog

GTU OS Program - 11 Filters

GTU OS Program - 8

GTU OS Program - 13 Date Validator