Home Java Java-tips Data Strings Q-pr-string-using-loops Programming - max3() method

Ask Questions?

View Latest Questions

Advertisement


 
 

Programming - max3() method
Posted on: July 26, 2006 at 12:00 AM
Write a method which has three double parameters and returns the largest value.

Java: Programming - max3() method

Problem

Write a method which has three double parameters and returns the largest value.

Details

  • Method only. Write only the method, not main program.
  • No I/O. As usual, this method should do no I/O.
  • No Math methods You may not use Math.max() or Math.min()
  • Method header. The method should be defined using this header.
    public static double max3(double a, double b, double c)
  • Example.
    d = max3(7.5, -9999.999, 1.0);
    This would assign 7.5 to d.
Advertisement


DMCA.com