1. Write a java
Your program should have 6 lines of output listing five colors. The sample output will like
this:
Five colors are:
Blue
Green
Red
Purple
Orange
Your output should have the first line exactly as shown above. The following 5 lines should
be your own.
2.Write a java program:
Your program should take one command-line argument, a person's name, and create output
using that name. For example, if you enter the name: Alex, the output should be:
Hello Alex, how are you?
Use String concatenation to create your output statement.
3.Write a java program:
This program should take two command line arguments and create the following output. For
example, if the command line values were Bob and Alice, the output would be:
Hello Bob, my name is Alice.
Use String concatenation to create your output statement.
4.Write a java program:
Using a single print() method [i.e., System.out.print()], create output of the first 6 lines
(including the title) of the following poem. Include quotations and newline characters in your
output.
The Irish Colonel
Said the king to the colonel,
"The complaints are eternal,
That you Irish give more trouble
Than any other corps."
Said the colonel to the king,
"This complaint is no new thing,
For your foemen, sire,
have made it A hundred times before."
- Sir Arthur Conan Doyle
5.Write a java program:
Your program will input 2 integer values from the command-line. (Remember the
command-line input enters your program through main() method. You'll need to convert the
values from String data type to integer data type. Use Integer.parseInt() method.)
Using the two values entered (which could be any integers), create the following output
statements (the example assumes the input values were 10 and 14):
10 + 14 = 24
10 - 14 = -4
10 X 14 = 140
10 / 14 = 0
10 % 14 = 10
You will have 5 lines of output. Put spaces in your output as shown in the sample output.
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 images
- Write a Java program named Words that asks the user to enter four words. The program should then analyze each of the four words so that it can report the length of each word as well as the positions of the five vowels within each word. For a sample run where the user enters the words: she smiles third frisbee the console screen must look as follows: Enter 4 words: she smiles third frisbee Word 1 = "she" Length = 3 position of vowels: 'a' = -1, 'e' = 2, '1' = -1, '0' = -1, '0' = -1, = -1, 'u' = -1 Word 2 = "smiles" Length = 6 position of vowels: 'a' = -1, 'e' -1, 'e' = 4, '1' = 2, 'i = 2, '0' = -1, 'u' = -1 Word 3 = "third" Length = 5 position of vowels: 'a' = -1, 'e' = -1, = -1, 'i' = 2, '0' = -1, 'u' = -1 Word 4 = "frisbee" Length = 7 position of vowels: 'a' = -1, -1, 'e' 'e' = 5, 5, '1' '1' = 2, 2, '0' '0' = -1, 'u' = -1 For a sample run where the user enters the words: shoe shoe chime wallabees the console screen must look as follows: Enter 4 words: shoe shoe chime wallabees Length…arrow_forwardJava Programmingarrow_forwardIN JAVA - Write a program whose input is two integers, and whose output is the first integer and subsequent increments of 5 as long as the value is less than or equal to the second integer. End with a newline. Ex: If the input is: -15 10 the output is: -15 -10 -5 0 5 10 Ex: If the second integer is less than the first as in: 20 5 the output is: Second integer can't be less than the first. For coding simplicity, output a space after every integer, including the last. BASE CODE: import java.util.Scanner; public class LabProgram { public static void main(String[] args) { /* Type your code here. */ }}arrow_forward
- Write in Java Prompt the user for a string that contains two strings separated by a comma. Examples of strings that can be accepted: Jill, Allen Jill , Allen Jill,Allenarrow_forwardPlease answer question. This is pertaining to Java programming language 1-26arrow_forwardWrite a FULL Java procedural program for a simple word guessing game. Below is an example of the required program behaviour. The bold text is user keyboard input. The player is allowed to guess one letter or the whole word incorrectly up to 5 times; each incorrect guess is called a “strike”. The program starts by displaying one full stop (’.’) for each character of the secret word. You may assume the word is hardcoded into the game, is in lower case, and is of length greater than one. In each round of the game, the game first checks if the player has reached the maxinum number of strikes; if so, the player loses and the game ends. If not, the game prints an input prompt. The player then guesses either one letter (by entering a single character) or the whole word (by entering multiple characters). If a single letter is guessed correctly, meaning the character occurs in the word, the game reveals the positions of those occurrences in the word and proceeds to the next round. If the whole…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education