SHARE
SPREAD
HELP

The Tradition of Sharing

Help your friends and juniors by posting answers to the questions that you know. Also post questions that are not available.


To start with, Sr2Jr’s first step is to reduce the expenses related to education. To achieve this goal Sr2Jr organized the textbook’s question and answers. Sr2Jr is community based and need your support to fill the question and answers. The question and answers posted will be available free of cost to all.

 

#
Authors:
Barbara Dolye
Chapter:
Methods And Behaviors
Exercise:
Exercises
Question:19 | ISBN:9781285096261 | Edition: 4

Question

Given the following task, which would be the most appropriate method heading?
A method receives three whole numbers as input. The values represent
grades. They should be unchangeable in the method. The method should
return the average with a fractional component.
a. static double DetermineGrade(int grade1, int grade2,
int grade3)
b. static int DetermineGrade(int grade1, int grade2,
int grade3)
c. static int int int DetermineGrade(double finalAverage)
d. static double DetermineGrade(ref int grade1,
ref int grade2,
ref int grade3)
e. static void DetermineGrade( )

TextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbook

Answer

The correct answer is a. static double DetermineGrade(int grade1, int grade2, int grade3)

Explanation:

  • The method name "DetermineGrade" accepts three integer parameter grade values, grade1,grade2 and grade3.
  • This method should return the average with a fractional component. So, return type should be "double".
  • The values represent grades in this method. They should be unchangeable in the method. So, it should be "static".

So, the correct answer is (a).

0 0

Discussions

Post the discussion to improve the above solution.