FUNCTIONS BASED PROGRAM - convert inches & feet into cm
class distance
{
double distinches, distfeet;
void func(double inches, double feet)
{
distinches=inches;
distfeet=feet;
}
void compute()
{
double cm;
cm=2.54*distinches + 30.48*distfeet; //1 INCH=2.54 cm &1 feet=30.48 cm
System.out.println("The total distance in centimetres is = " +cm);
}
}
{
double distinches, distfeet;
void func(double inches, double feet)
{
distinches=inches;
distfeet=feet;
}
void compute()
{
double cm;
cm=2.54*distinches + 30.48*distfeet; //1 INCH=2.54 cm &1 feet=30.48 cm
System.out.println("The total distance in centimetres is = " +cm);
}
}
0 comments:
Post a Comment