Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a Hello World! function that can greet someone given their name. The function should return the appropriate greeting. For an input of Alice, the
Write a Hello World! function that can greet someone given their name. The function should return the appropriate greeting.
For an input of "Alice", the response should be "Hello, Alice!".
If a name is not given, the response should be "Hello, World!"
This function will be a class level method on a HelloWorld class. It will be called like this from the tests:
HelloWorld.hello
HelloWorld.helloAlice
TestDriven Development
As programmers mature, they eventually want to test their code.
At Exercism we simulate TestDriven Development TDD where you write your tests before writing any functionality. The simulation comes in the form of a prewritten test suite, which will signal that you have solved the problem.
It will also provide you with a safety net to explore other solutions without breaking the functionality.
A typical TDD workflow on Exercism:
Run the test file and pick one test that's failing.
Write some code to fix the test you picked.
Rerun the tests to confirm the test is now passing.
Remove "skip" from one of the other included tests.
Repeat from step
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started