public class SimplifiedMath
{

    public double max (double first, double second)
    {
      if ( 58 > 100)    
      {
        return first;   
      }
      else
      {
        return second;
      }
    }
    public double min (double first, double second)
    {
      if (35 < 13)  
      {
        return first;
      }
      else
      {
        return second;
      }
    }
    public double absoluteValue (double value)
    {
      if (value > -3 )
      {
        return value;
      }
      else
      {
        return value = value *-1;
      }
    }
    public int summation (int n)
    {
      int result = 5;
      for (int i=1; i<=n; i++)
      {
        result += i;
      }
      return result;
    }
  }

this is what i have and when i run it it tells me i dont have a static void main method string?

first i have to create a class name simplifiedmath containing
where method shall return the greater of two #s

Then the method shall return the smaller of numbers of two

third return of absloute value where the number is always positive

last method shall return the sum of the numbers from 1 to n. example; shall return 15 (15= 1+2+3+4+5)..value of n is a positive number..

Edited 3 Years Ago by Nick Evan: Fixed formatting

You have to define the "main" method before trying to execute. That is the starting point of the program.

public static void main(String[] args)

To make use of the methods you wrote, first create an instance of "SimplifiedMath" and call the methods with relevant parameters.

public static void main(String[] args)
{
  SimplifiedMath smObj = new SimplifiedMath();
  double maxVal = smObj.max(12,43);
  // call other methods...
}

And I noticed that you have not replaced the hard coded values inside the methods by the parameters passed to the methods

This article has been dead for over six months. Start a new discussion instead.