Question

In: Computer Science

using java: There's a hole in the bottom of the sea There's a hole in the...

using java:

There's a hole in the bottom of the sea
There's a hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea

There's a log in the hole in the bottom of the sea
There's a log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea

There's a bump on the log in the hole in the bottom of the sea
There's a bump on the log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea

Want at least 5 inputs from the user (variables), meaning you'll also
end up printing 5 different verses or stanza.

Solutions

Expert Solution

Dear student,

The code in JAVA programming language to the above problem statement given by you is as follows :

CODE :

import java.io.*;
import java.util.*;
public class Main
{
public static void main(String[] args)
{
Scanner in=new Scanner(System.in);
String words[]= new String[5];
  
System.out.println("Please enter a word");
words[0]=in.nextLine()+" in the";//takes the first word from the user
for(int i=1;i<5;i++)//rest of the words
{
System.out.println("Please enter a word");
words[i]=in.nextLine()+" in the "+words[i-1];//takes the word from the user
}
  
for(int i=0;i<5;i++)//to print the verses
{
String ins1="There's a "+words[i]+" hole in the bottom of the sea";
System.out.println(ins1);
System.out.println(ins1);
System.out.println("There's a hole, there's a hole");
System.out.println("There's a hole in the bottom of the sea");
System.out.println();

}
  
}
}

SAMPLE OUTPUT :

I have tried to explain it in very simple language and I hope that i have answered your question satisfactorily.Leave doubts in comment section if any.


Related Solutions

cylindrical container with circular hole at the bottom with diameter d , is filled with water...
cylindrical container with circular hole at the bottom with diameter d , is filled with water to height h . Which of the following statement is correct for the itime required to empty the container If d is constant , the time is inversely proportional to the height of water . If h is constant , the time is inversely proportional to the area of hole . If his constant , the time is directly proportional to the area of...
please code in java: There's an arraylist of "words" with 250,000 words. Pick 50,000 randomly chosen...
please code in java: There's an arraylist of "words" with 250,000 words. Pick 50,000 randomly chosen words from "words" and add them to a "search" array (not Arraylist) of strings.
Water (density p=1000 kg/m^3) is discharging from through a hole at the bottom of a graduated...
Water (density p=1000 kg/m^3) is discharging from through a hole at the bottom of a graduated cylinder. The mass flow rate exiting the container may be approximated by: mass flow rate = C*p*A*(2*g*y)^(1/2) Where C is the dimensionless discharge coefficient , A is the area of the discharge hole, g is the acceleration due to gravity, and y is the water height in the container. The diameter of the graduated cylinder is 8 cm. For the following givens, estimate the...
A 15.0 kg solid silver statue is raised from the sea bottom. Please calculate the tension...
A 15.0 kg solid silver statue is raised from the sea bottom. Please calculate the tension in the hoisting cable when the statue is at rest and completely under water.
2.   A rivet is to be inserted into a hole. If the standard deviation of hole...
2.   A rivet is to be inserted into a hole. If the standard deviation of hole diameter exceeds 0.02 mm, there is an unacceptably high probability that the rivet will not fit. A random sample of n = 15 parts is selected, and the hole diameter is measured. The sample standard deviation of the hole diameter measurements is s = 0.016mm. At α = 0.05 conduct a hypothesis test to investigate to indicate that the standard deviation of hole diameter...
A hole was shot in a pipeline using a high-powered rifle. The discharge rate of oil...
A hole was shot in a pipeline using a high-powered rifle. The discharge rate of oil from the pipeline was estimated at 140 gal/min. Estimate the hole diameter (in inches) assuming a pipeline pressure of 500 psig (72,000 lbf/ft2), discharge coefficient is 0.61, and the density of water is 62.4 lbm/ft3. The specific gravity for the oil is 0.93.
In Java Develop, test, and execute a graphics application for simulations using Java. Create a Java...
In Java Develop, test, and execute a graphics application for simulations using Java. Create a Java application. Given a set of events, choose the resulting programming actions. Understand the principles behind Java. Understand the basic principles of object-oriented programming including classes and inheritance. Deliverables .java files as requested below. Requirements Create all the panels. Create the navigation between them. Start navigation via the intro screen. The user makes a confirmation to enter the main panel. The user goes to the...
If space has no medium, than what is the black hole "punching" a hole in? If...
If space has no medium, than what is the black hole "punching" a hole in? If you answer spacetime, than what is spacetime?
The Hole Class Description: For the Hole class, there are three instance variables: the par for...
The Hole Class Description: For the Hole class, there are three instance variables: the par for the hole, the length of the hole in yards, and a Boolean valued indicator of whether the hole is one in which the players’ full drives will be measured for distance. John clarifies: The length of the hole in yards determines par for the hole. The current standard is: No more than 250 yards Par 3 251 to 470 yards Par 4 471 to...
Jackson Hole Manufacturing
Jackson Hole Manufacturing is a small manufacturer of plastic products used in the automotive and computer industries. One of its major contracts is with a large computer company and involves the production of plastic printer cases for the computer company’s portable printers. The printer cases are produced on two injection molding machines. The M-100 machine has a production capacity of 25 printer cases per hour, and the M-200 machine has a production capacity of 40 cases per hour. Both machines...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT