1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
WARRIOR [948]
3 years ago
8

Write the definition of a method dashedLine, with one parameter, an int. If the parameter is negative or zero, the method does n

othing. 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.
Computers and Technology
1 answer:
ZanzabumX [31]3 years ago
5 0

Answer:

import java.util.Scanner;

public class DashLine {

public static void main(String[] args) {

// Declaring variables

int n;

/*

* Creating an Scanner class object which is used to get the inputs

* entered by the user

*/

Scanner sc = new Scanner(System.in);

// Getting the input entered by the user

System.out.print("Enter a number :");

n = sc.nextInt();

// calling the method by passing the user entered input as argument

dashedLine(n);

}

//This method will print the dashed line for number greater than zer

private static void dashedLine(int n) {

if (n > 0) {

for (int i = 1; i <= n; i++) {

System.out.print("-");

}

System.out.println();

}

}

}

Explanation:

You might be interested in
1. Se requiere implementar un conversor unipolar que tendrá una tensión analógica variable entre 0 y 2 V pico. Deberá tener una
PolarNik [594]

Answer:

A

Explanation:

Because

7 0
3 years ago
Give two separate print statements: one will print your name, the other will print your major. Ensure that both will print on th
Alexus [3.1K]

Answer:

// here is code in java.

// import package

import java.util.*;

// class definition

class Main

{

   // main method of the class

public static void main (String[] args) throws java.lang.Exception

{

   try{

      // print the name

       System.out.print("my name is Sam. ");

       // print the major

       System.out.print("my major is CS.");

   }catch(Exception ex){

       return;}

}

}

Explanation:

In java, System.out.print() will print the statement but didn't go to the next line.If there is another System.out.print(), then it will also print into the same line.So here first the System.out.print() will print the name and second will print the major in the same line.

Output:

my name is Sam. my major is CS.

4 0
3 years ago
Which symbol is at the beginning and end of a multiline comment block? &amp;&amp;&amp; """ %%% ###
yawa3891 [41]

Answer:

#

Explanation:

I have notes on it we learned it in 8th

7 0
3 years ago
A function ________ contains the statements that make up the function.
mestny [16]

Answer:

A) definition

Explanation:

3 0
3 years ago
Contextual targeting method mean
Semenov [28]
Definition - What does Contextual Advertising mean? Contextual advertising is a form of online advertising that displays ads on websites based on the keywords, content or theme of the website. It is a targeted advertising technique that is commonly used in ads on blogs, websites and other online media.
3 0
3 years ago
Other questions:
  • DJ wants to see how his document will look when printed. Where would he find the button to see the document in print view? the P
    5·2 answers
  • Generally speaking, mobile sites are good for acquiring new customers and inspiring new relationships while mobile apps are good
    6·1 answer
  • When did the digital revolution begin
    10·1 answer
  • What is the term for the conversion of a bitmap image to a vector image?
    8·1 answer
  • RTOS stands for ______ Time Operating System.
    11·1 answer
  • Text Questions
    15·1 answer
  • Sebutkan contoh komputer analog, komputer digital, dan komputer hybrid
    9·1 answer
  • (C) Describe about the different types of computer<br> peripherals and memory devices.
    9·1 answer
  • Which of the following is typiacally the last step of the mail merge process
    11·1 answer
  • oe, a user, receives an email from a popular video streaming website. the email urges him to renew his membership. the message a
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!