class DB {
private float feet, inches;
DB(float f, float i){
feet = f;
inches = i;
}
float getFeet(){
return feet;
}
float getInches(){
return inches;
}
void getDistanceDB(){
System.out.println("Feet: " +feet+ "\tInches: "+ inches);
}
}
class DM {
private double meters;
private double centimeters;
DM(double m, double c){
meters =m;
centimeters = c;
}
double getMeters(){
return meters;
}
double getCentimeters(){
return centimeters;
}
void getDistanceDM(){
System.out.println("Feet: " +meters+ "\tInches: "+centimeters);
}
}
public class Q214665 {
int n = 10;
int h = 5;
DM m = new DM(n, h);
DB v = new DB(2, 4);
void addDistance(){
double total_distance;
total_distance = m.getMeters() + (m.getCentimeters() / 100 ) + (v.getFeet() +( v.getInches() / 12) / 3.2808399);
String distance = String.valueOf(total_distance);
String [] arr_distance = distance.split(".",2);
System.out.print(total_distance);
}
Comments
Leave a comment