THE QUESTIONS ASK TO "Write a value-returning method that takes as parameters two double values and returns the sum of the values. Write a program to test your method."
here's my code
import java.util.*;
import java.io.*;
import java.lang.Math.*;
public class ch3_PrExercise3
{
static Scanner console = new Scanner(System.in);
public static double sum(double n1, double n2)
{
System.out.print("Enter n1: ");
n1 = console.nextDouble();
System.out.println();
System.out.print("Enter n2: ");
n2 = console.nextDouble();
System.out.println();
return n1 + n2;
}
}

New Topic/Question
Reply




MultiQuote




|