Problem solving tasks JavaScript

Hello and good day! Hope someone can help me with the practical tasks.
Im so stuck and i have no idea how to move forward.

This is the task:

Hello you

Write a program that will read a name as input from the console and salute the person.

Input

  • On the single line you will receive a name (ex: John)

Output

  • You should print a salutation to the person (ex: Hello, John!)

Input

John

Output

Hello, John!

And this is my solution :
function greeting (name = ‘John’) {
print(Hello, ${name}!)
}
greeting();

Ps. I’m using the proper syntax for string interpolation.

The system keeps rejecting it and i have no idea why.
I ran the code in VS Code and it works. So can somebody tell what I’m doing wrong?

Hi @anon41450879, try passing gets() to the function call.

That’s the one thing I just can’t get… I tired reading the article but it’s just poorly explained or I am too dull to understand it.

Can I ask if you can give me an active example, it tried several times but alas no success.

Here you just need to change the last line like so:

greeting(gets());

In the materials there was an explanation on how to use it.:slight_smile:

Same with me! I write it in Java and run it on ItelliJ IDEA as recommended by the self preparation materials on Telerik’s platform. So on intelliJ runs it perfectly and gives me the desired result, but the platform keeps rejecting it…
If you can help me solve it in Java will be highly appreciated!
Thank you!

I’ve given up on Telerik Academy. Their system, that evaluates your solution, is poop. You have to adapt your code and waist your time with instructions that are plain horrible, not to mention unnecessary.
Others like SoftUni are miles better.
You write your code, then submit it. Simple, clean, efficient.
I wanted to study in Telerik, but after talking to people, and from my own experience they seem to have lost their touch.
But that’s my opinion.

Got you. From my experience so far it seems you have to be very careful to read the details in the task. For example with this one my problem was that I was not inserting the " ! " at the end and only because of that the system wasn’t accepting my solution.
If you still need it I was able to solve it though.
Posted it as a reply to your post.
Good luck!

import java.util.Scanner;

public class Main {

public static void main(String[] args) {
   Scanner user_input = new Scanner(System.in);
    String name;
    name = user_input.next();
    String greeting = "Hello, ";

    System.out.println( greeting + name + "!" );

}

}

1 Like

Hello, Emil,

I’m sorry to hear that you have “given up” on us.

But as Yoanna very accurately pointed out,

This applies not only for solving small tasks like the ones discussed here but to bigger problems as well. The job of a software developer is not to just

The job of a software developer is so highly rated because there is a thinking processed involved and you have to foresee every little mishap and every possibility for failure. As unfortunate (and somewhat tedious) as it is, coding up the program is the FOURTH step of the software development life cycle.

So my advice is, no matter where (at Telerik Academy or wherever it may be), do not look for the “easy way out”. Learn to plan ahead and really put your mind to work.

Sincerely,
Todor