Question (Java): Write a method signature that matches the description. If names
ID: 3709179 • Letter: Q
Question
Question (Java): Write a method signature that matches the description. If names are not provided for the variables, be sure to give them names:
1. A method named giveMeANumber that returns an int with no parameters.
2. A method named giveMeAC that returns a char with no parameters.
3. A method named giveMeAnS that returns a char with no parameters.
4. A method named giveMeA210 that returns an int with no parameters.
5. A method named whatDoesThatSpell that returns a String with no parameters.
6. A method named deleteFile that returns a boolean with a String as a parameter.
7. A method named initSeries that returns an int array with an int named N as a parameter.
8. A method named delta that returns a float with 2 floats as parameters.
9. A method named delta2D that returns a float array with 2 float arrays and an int as parameters.
10. A method named degreesInAPolygon that returns an int with an int as a parameter.
11. A method named compareFiles that returns a String array with two File objects as parameters.
12. A method named exit that takes an int as a parameter.
13. A method named QueuePop that returns a Record object and takes a Queue object as a parameter.
14. A method named whatIsThis that returns an array of int arrays and takes an array of int arrays and two ints as parameters.
15. A method named dot that returns a double and takes two List of floats objects as parameters.
I've been stuck on this question for a few days now.
Thank you in advance.
Explanation / Answer
Hi Dear,
Please find my answer:
1. A method named giveMeANumber that returns an int with no parameters.
Ans: int giveMeANumber();
2. A method named giveMeAC that returns a char with no parameters.
Ans: char giveMeAC();
3. A method named giveMeAnS that returns a char with no parameters.
ANs: char giveMeAnS();
4. A method named giveMeA210 that returns an int with no parameters.
Ans: int giveMeA210();
5. A method named whatDoesThatSpell that returns a String with no parameters.
Ans: String whatDoesThatSpell();
6. A method named deleteFile that returns a boolean with a String as a parameter.
Ans: boolean deleteFile(String fileName);
7. A method named initSeries that returns an int array with an int named N as a parameter.
Ans: int[] initSeries(int N);
8. A method named delta that returns a float with 2 floats as parameters.
Ans: float delta(float f1, float f2);
9. A method named delta2D that returns a float array with 2 float arrays and an int as parameters.
Ans: float[] delta2D(float f1, float f2, int n);
10. A method named degreesInAPolygon that returns an int with an int as a parameter.
Ans: int degreesInAPolygon(int n);
11. A method named compareFiles that returns a String array with two File objects as parameters.
Ans: String compareFiles(File f1, File f2);
12. A method named exit that takes an int as a parameter.
Ans: void exit(int n);
13. A method named QueuePop that returns a Record object and takes a Queue object as a parameter.
Ans: void QueuePop(Record rec, Queue q);
14. A method named whatIsThis that returns an array of int arrays and takes an array of int arrays and two ints as parameters.
Ans: int[] whatIsThis(int arr[], int n1, int n2);
15. A method named dot that returns a double and takes two List of floats objects as parameters.
Ans: double dot(List<Float> list1, List<Float> list2);