Skip to content

liam-ohara/give-me-a-diamond

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Give me a Diamond

This application was written as a solution to the Give me a Diamond kata published on the Codewars website.

This application will accept a positive odd number input by the user, and return a string of asterisks to represent a diamond.

Installation and Setup

Prerequisites

Installation

  1. Download diamond.jar from the /out/artifacts/diamond_jar/ directory of this repository.
  2. Move the downloaded file to another local directory on your device of your choosing.
  3. Open your command line interface / terminal and navigate to the local location of diamond.jar.
  4. Run the application with the following command:

java -jar diamond.jar

Usage

Once you have run the application with the command above, you will be shown the following text:

So you want a diamond? The size must be provided as an odd positive number.
Please enter the required diamond size and hit ENTER.

Examples

Correct use

So you want a diamond? The size must be provided as an odd positive number.
Please enter the required diamond size and hit ENTER.
7
   *
  ***
 *****
*******
 *****
  ***
   *

Invalid number input

So you want a diamond? The size must be provided as an odd positive number.
Please enter the required diamond size and hit ENTER.
0
You must provide diamond size as a positive odd integer.

Less than the minimum size

So you want a diamond? The size must be provided as an odd positive number.
Please enter the required diamond size and hit ENTER.
1
Too small. The smallest diamond possible is 3.

About

A Java application that creates an ASCII representation of a diamond.

Topics

Resources

Stars

Watchers

Forks

Languages