cn.mindstack.Cowsay Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Cowsay Show documentation
Show all versions of Cowsay Show documentation
Cowsay is a test application from mindstacn.cn
The newest version!
/*
* The MIT License (MIT)
*
* Copyright (c) 2016 tony
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package cn.mindstack;
/**
* Created by tony on 16/3/31.
*/
public class Cowsay {
/**
* cowsay
* @param arguments the messages we want to printout
*/
public static void main(String[] arguments) {
/*
* The message we want to print out
*/
String message = "";
/*
* This is for the case you do not give the programm a parameter
*/
if (arguments.length == 0) {
System.out.println("Start the programm with:");
System.out.println("\t# java Cowsay \n");
System.out.println("e.g.");
System.out.println("\t# java Cowsay Hello I am tony and I like Java!");
System.out.println("");
}
/*
* Merging all parameters to one String
*/
for (int i = 0; i < arguments.length; i++) {
message += arguments[i] + " ";
}
/*
* Here begins the formatted output of the tux.
*
* Test on your own how it works. Trial & error is
* the best way.
*/
System.out.print(" ");
for (int i = 0; i <= message.length() + 1; i++) {
System.out.print("_");
}
System.out.println("");
System.out.println(" < " + message + " >");
System.out.print(" ");
for (int i = 0; i <= message.length() + 1; i++) {
System.out.print("-");
}
System.out.println("");
System.out.println(" \\");
System.out.println(" \\");
System.out.println(" \\");
System.out.println(" .--.");
System.out.println(" |o_o |");
System.out.println(" |:_/ |");
System.out.println(" // \\ \\");
System.out.println(" (| | )");
System.out.println(" /'\\_ _/`\\");
System.out.println(" \\___)=(___/");
}
/**
* 连接字符串
* @param one 第一个字符串
* @param two 第二个字符串
* @return 两个字符串连接值
*/
public String concatenate(String one, String two){
return one + two;
}
}