My issue
output is same as result then why it shows wrong answer
My code
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static String greet(String name) {
return "Hello, " + name + "!";
}
// Function to capitalize a text
public static String capitalize(String text) {
return text.toUpperCase();
}
// Function to greet and capitalize a name
public static String greetAndCapitalize(String name) {
//update the code here
name= greet( name);
name= capitalize(name);
return name;
}
public static void main (String[] args) throws java.lang.Exception
{ String name = "Alice";
String finalResult = greetAndCapitalize(name);
// Display the results
System.out.println("Greeting: "+greet(name));
System.out.println("Capitalized Greeting: "+capitalize(greet(name)));
System.out.println("Final Result: " + finalResult);
}
}
Learning course: Placement preparation using Java
Problem Link: CodeChef: Practical coding for everyone