+ 1

How do I get code coach to work

I have issues with the code coach. Even tho my function is the same as required, there is no output for my functions. https://code.sololearn.com/c3S5ICABQdeQ/?ref=app

18th Apr 2022, 5:43 PM
Magda Muffin
11 Respuestas
+ 1
Post the task description along with tried code link by saving it in playground.. Then some one from community may help you to find the problem... Hope you understand it..
18th Apr 2022, 5:46 PM
Jayakrishna 🇮🇳
+ 1
You are in charge of security at a casino, and there is a thief who is trying to steal the casino's money! Look over the security diagrams to make sure that you always have a guard between the thief and the money! There is one money location, one thief, and any number of guards on each floor of the casino. Task: Evaluate a given floor of the casino to determine if there is a guard between the money and the thief, if there is not, you will sound an alarm. Input Format: A string of characters that includes $ (money), T (thief), and G (guard), that represents the layout of the casino floor. Space on the casino floor that is not occupied by either money, the thief, or a guard is represented by the character x. Output Format: A string that says 'ALARM' if the money is in danger or 'quiet' if the money is safe. Sample Input: xxxxxGxx$xxxT Sample Output: ALARM
18th Apr 2022, 5:48 PM
Magda Muffin
+ 1
Your program should accept a input in format specified in description. Here you need take a word of string. Then just call your method with passing input string and print returned result.. No more or less characters to be printed on output.... Just output is need is "quiet" or "ALARM"
18th Apr 2022, 6:09 PM
Jayakrishna 🇮🇳
18th Apr 2022, 5:53 PM
Magda Muffin
0
But I've had this problem with multiple programs, I check it myself in the Main function and the function works, but when I run the tests, there is just no output at all
18th Apr 2022, 5:54 PM
Magda Muffin
0
Where it working?? Your main method is empty so this program just compiles, and executes but without any instructions.. It's a empty program to interpreter currently..
18th Apr 2022, 6:00 PM
Jayakrishna 🇮🇳
0
Updated
18th Apr 2022, 6:04 PM
Magda Muffin
0
So instead of returning the String, I should just print it in the function?
18th Apr 2022, 6:10 PM
Magda Muffin
0
No. You can print in method without anything returning or print in main method returned value.. I mean like this : System.out.println(sec("xxxxxGxx$xxxT")); And instead of passing a hardcode value, take input and pass to method. Code coach testes your code with different outputs.. So program should work on any input..
18th Apr 2022, 6:16 PM
Jayakrishna 🇮🇳
0
So how to I "take the input" then? Like how does code coach tests it?
18th Apr 2022, 6:28 PM
Magda Muffin
0
Complete this lesson , it explains well. Also All methods is in this.. https://www.sololearn.com/learn/Java/2220/
18th Apr 2022, 6:40 PM
Jayakrishna 🇮🇳