the code is given below with compilation
Embedding an online compiler
into a website
The sum of 2 distance is measured in calculators Distance 1= 10 feet 24 inch Distance 2= 18 feet 4 inch A class distance has following members Instance variables int f1,f2 (/ integers to store the two feet values) int in1, in2 ( integer to store the two inches) Member Function Distance(int f, int n1, int ff, int n2) constructor to intialize the datat members in the following sequence (f1,in1,f2,in2) void show_distance(): to display both the distance in a suitable manner void sum_of_distance(): to find the sum of distances Use a main method to call all the above methods and functions
byJAVA EXPERT
•
•
2 min read