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

the code is given below with compilation Embedding an online compiler into a website

Post a Comment

Please Select Embedded Mode To Show The Comment System.*

Previous Post Next Post

It looks like you're using an ad blocker. We rely on ads to keep our site free, please whitelist us!

Click here to continue

Please whitelist our site to continue enjoying our content.

Whitelist | Close