Answered step by step
Verified Expert Solution
Link Copied!

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.hello('Alice')
Test-Driven Development
As programmers mature, they eventually want to test their code.
At Exercism we simulate Test-Driven Development (TDD), where you write your tests before writing any functionality. The simulation comes in the form of a pre-written 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.
Re-run the tests to confirm the test is now passing.
Remove "skip" from one of the other included tests.
Repeat from step 1.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

XML Data Management Native XML And XML Enabled Database Systems

Authors: Akmal Chaudhri, Awais Rashid, Roberto Zicari, John Fuller

1st Edition

ISBN: 0201844524, 978-0201844528

More Books

Students also viewed these Databases questions