Write the definition of a method dashedLine, with one parameter, an int. If the parameter is negative or zero, the method does nothing. Otherwise it prints a complete line terminated by a newline to standard output consisting of dashes (hyphens) with the parameter's value determining the number of dashes. The method returns nothing

Answers

Answer 1
Answer:

Answer:

The following are the program in the Java Programming Language.

//define a function

public void dashedLine (int x)

{  

//check the variable 'a' is greater than 0

if (x>0)

{

//declare integer data type variable

int i;

//set the for loop that iterates from 1 to variable 'a'

for (i=1;i<=x;i=i+1)

{

//print the following dashes

System.out.print("-");

}  

//for empty space

System.out.println("");

}

}

Explanation:

The following are the description of the program.

  • Define a function 'dashedLine()' and pass an argument 'x' in the function's parameter.
  • Then, set the if conditional statement that check the argument x is greater than 0 or not.
  • Then, declare the variable 'i' and set the for loop statement that iterates from 1 to the variable x then, print the dashes and print the empty spaces after every loop statement.

Related Questions

The ____ package contains frequently used classes and is implicitly imported into java programs.
The _____ is a blinking vertical line that indicates where the next typed character will appear. scroll box sheet tab insertion point split bar
Task location is less important than the task language. T or F
A slide _____ is a special animation effect used to progress from one slide to the next slide in a slide show.
Which of the following statements best explains why the term “emerging technologies” is a problematic tem?A. Exciting and revolutionary inventions are limited to people under thirty-years-old. B. Technology changes so rapidly that something newer is always present. C. There are too many types of technology to keep track of. D. People above the age of thirty-five see technology as unnatural.

The domain is the part of an Internet address that refers to a group of computers on a network a. True
b. False

Answers

The answer is true.
The domains are defined by IP (Internet Protocol) Addresses within the internet. In a network, the domain administered the group of computers and devices in a set of rules and procedures. In a same domain, all devices share a common part of the IP Address. 

Consider the following code segment. int[] seq = {3, 1, 8, 4, 2, 5}; for (int k = 1; k < seq.length; k++) { if (seq[k] >= seq[0]) System.out.print(seq[k] + " " + k + " "); } What will be printed as a result of executing the code segment?

Answers

Answer:

This program will complete in 5 iterations,

initially

Seq[0]=3

Iteration 1:

loop starting from 1 and ends at 5 so

when  K=1,   then seq[1]=1

if seq[1]>=Seq[0]    ==>     1 is not greater than equal to 3

so "nothing to print because condition not true"

Iteration 2:

Now

K=2 so seq[2]=8

if seq[2]>=Seq[0]    ==>     8 is greater than equal to 3

so "condition is true" the output will be

output="8","2" means seq[k]=8 and K=2

Iteration 3:

Now

K=3 so seq[3]=4

if seq[3]>=Seq[0]    ==>     4 is greater than equal to 3

so "condition is true" the output will be

output="4","3"  means seq[k]=4 and K=3

Iteration 4:

Now

K=4 so seq[4]=2

if seq[4]>=Seq[0]    ==>     2 is not greater than equal to 3

so "condition is not true" the output will be

output=nothing

Iteration 5:

Now

K=5 so seq[5]=5

if seq[5]>=Seq[0]    ==>     5 is greater than equal to 3

so "condition is true" the output will be

output="5","5"    means seq[k]=5 and K=5

Explanation:

Out of all the concepts learned throughout STATISTIC, which one was the most challenging to you, and why? Which concept do you see yourself using the most in your career?

Answers

interquarile range

I found everything easy, but some parts tripped me up.

A personal computer uses a number of chips mounted on a circuit board calleda. microprocessor
b. system board
c. daughter board
d. mother board

Answers

The answer is D. Motherboard

13. The Save As command is useful if you want to copy an open document and A. give the copy a new name.
B. remain in the original document.
C. delete the original document.
D. link it to the original document.

Answers

the answer would be A because when you first press Save As you are creating it then you would just press save every time you have tweaked it but if you wanted to shop that you had tweaked it (for example) then you would press Save As. I may be entirely wrong so don't just use my answer!!
A. give the copy a new name

Computer is created by aliens?!

Answers

The computer was invented by Tom Warburton.

Answer:

no

Explanation:

did u really think that computers were created by aliens