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
How can i fix this, if i log in my acc it keeps saying wrong nickname or pass. even though my email and pass is correct
Oksanka [162]

Answer:

미안해요. 나는 우리가 단지 부동일 중 하나를 모르지만 그것을 해결하는 방법을 모른다!.

8 0
2 years ago
What is the term of social media
seraphim [82]
It is used to describe a variety of web based platforms, applications, and technologies that allow people to socially interact online.
3 0
3 years ago
Design a class named Employee. The class should keep the following information in fields: Employee first name Employee last name
mixer [17]

Answer:

Explanation:

The following is written in Java and creates the Employee class with the variables requested and a getter setter method for each variable

package sample;

public class Employee {

   private String lastName, firstName, idNumber;

   

   public void Employee() {

   }

   public String getLastName() {

       return lastName;

   }

   public void setLastName(String lastName) {

       this.lastName = lastName;

   }

   public String getFirstName() {

       return firstName;

   }

   public void setFirstName(String firstName) {

       this.firstName = firstName;

   }

   public String getIdNumber() {

       return idNumber;

   }

   public void setIdNumber(String idNumber) {

       this.idNumber = idNumber;

   }

}

8 0
2 years ago
which software application offers a variety of templates for creating reports, flyers and newsletters that you can access within
sp2606 [1]
Presentation Softwares
4 0
3 years ago
Learning Task 3: Below are different electronic diagrams. Write the name of
sweet [91]

Answer:

WAOW

Explanation:

You did better than I can

8 0
2 years ago
Other questions:
  • In the U.S. highway numbering system, north-south routes have
    9·2 answers
  • Which tasks can Kim complete using the Customize Ribbon dialog box? Check all that apply.
    14·1 answer
  • What fields of engineering are in Biomedical
    7·1 answer
  • Which kind of device is hardware capable of transferring items from computers and devices to transmission media and vice versa?
    10·1 answer
  • Package Newton’s method for approximating square roots (Case Study: Approximating Square Roots) in a function named newton. This
    7·1 answer
  • Write a program that echos back any inputted integer greater than 1, and exits when a 0 is entered. Your program should use a co
    11·1 answer
  • If you wanted a smartphone with the fewest restrictions on application development which smartphone operating system should you
    9·1 answer
  • What is analog computer? where is it used​
    6·2 answers
  • What the difference between an operating system drive and a storage drive?
    6·1 answer
  • as a pc technician, you are on the road most of the day and use a laptop. when you get back to your office at the end of the day
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!