Custom functions and maths
in
Programming Questions
•
11 months ago
Hey people, I think I have got quite a tad lost with this.
Here is my question;
Mucho thanks in advance.
Here is my question;
Write a function called newNumbers(double a, double b) which takes in two parameters a and b. The function checks if the two numbers are identical or not identical. If identical, the string “a and b are identical” is displayed in the console window, where a and b are the values of a and b. If not identical, the string “ a and b are not identical” is displayed in the console window. Finally, the function should return the sum of a and b if they are not identical, and return either a or b if they are identical
and here is the code I think is the correct answer.. although im getting errors and its not looking complex enough.. any help? Processing is slowly killing my brain.. haha!
- int newNumbers(double c, double d)
- {
- if (c <= d);
- println("A and B are identical");
- else if (c >= d);
- println ("A and B are not identical");
- return a = b;
- }
Mucho thanks in advance.
1