Going metric. (convert feet into meters) write a program that reads a number in feet, converts it to meters, and displays the result. one foot is 0.305 meters. input and prompts.the program prompts for the feet with the message "enter a value for feet: ". output . the output is of the form "x feet is y meters" where x is the number read in and y is the number of meters computed by the program . class names. your program class should be called femtometers

Respuesta :

tonb
class femtometers
{
   const double FEET_TO_METERS = 0.3048;
   public:
   double ConvertToMeters(double feet)
   {
      return feet * FEET_TO_METERS;
   }
};


int main()
{
  double feet = 0;
  femtometers converter;

  do {
    printf("enter a value for feet:  ");

    scanf_s("%lf", &feet);
    double meters = converter.ConvertToMeters(feet);
    printf("%lf feet is %lf meters\n", feet, meters);
  } while (feet > 0.0);

  return 0;
}

ACCESS MORE
EDU ACCESS
Universidad de Mexico