
LANGUAGE: JAVA
CHALLENGE:
Write the definition of a method printGrade, which has a char parameter and returns nothing. The method prints on a line by itself the message string Grade: followed by the char parameter (printed as a character) to standard output. Don’t forget to put a new line character at the end of your line.
SOLUTION:
void printGrade(char grade){ System.out.println("Grade: " + grade); }
The is not needed just remove.
Nicholas, I have updated the post. Thank You for your feedback.
HERE IS THE C CODE:
void printGrade(char c)
{
printf(“Grade: %c\n”,c);
}
void printGrade(char grade)
{
cout << "Grade: " << grade << "\n";
}
THIS IS THE C++ CODE