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
Ilya [14]
3 years ago
11

Write the definition of a function dashedLine, with one parameter, an int. If the parameter is negative or zero, the function do

es nothing. Otherwise it prints a complete line terminated by a new line character to standard output consisting of dashes (hyphens) with the parameter's value determining the number of dashes. The function returns nothing.
Computers and Technology
1 answer:
Orlov [11]3 years ago
8 0

Answer:

public static void dashedLinses(int num){

       if(num>0){

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

               System.out.print("-");

           }

           System.out.println();

       }

   }

}

Explanation:

  • The function is written with Java programming language
  • As required by the question, it accepts an int parameter and returns nothing.
  • An if statement is used to check the condition of n greater than 0
  • Using a for loop, it outputs a line whose length is determined by the value of the parameter
  • A complete code with the main method is given below

<em>public class num9 {</em>

<em>    public static void main(String[] args) {</em>

<em>    int num= 2;</em>

<em>    dashedLinses(num);</em>

<em>    }</em>

<em>    public static void dashedLinses(int num){</em>

<em>        if(num>0){</em>

<em>            for(int i=1; i<=num; i++){</em>

<em>                System.out.print("-");</em>

<em>            }</em>

<em>            System.out.println();</em>

<em>        }</em>

<em>    }</em>

<em>}</em>

You might be interested in
Which type of security personnel may work for government as well as for private security agencies?
monitta

Answer: A security guard

Explanation:

3 0
3 years ago
Read 2 more answers
Assembly language program wich indetify largest number from the five elements 51,44,67,30,99​
Tresset [83]

Answer:

V

Explanation:

7 0
3 years ago
3. List three common vector image file types.
nika2105 [10]
Constructed using mathematical formulas rather than individual colored blocks, vector file types such as EPS, AI and PDF* are excellent for creating graphics that frequently require resizing.
8 0
3 years ago
Sharon is thinking about opening a bakery. She knows she wants to set her own hours, reduce her stress and make a profit. But sh
hodyreva [135]
Please provide complete details.
4 0
3 years ago
Which of the following describes a source file? A. It contains the information to be copied. B. It's where copied information is
jeyben [28]
I'd say it's A because source file originally means "a file that contains original data," which I believe A has the closest meaning to it.
8 0
3 years ago
Read 2 more answers
Other questions:
  • He ____________ may include a high-level WBS in a graphic chart format or as an indentured list of the work elements and associa
    14·1 answer
  • Soo...My Old 3DS XL haven't been touched in around a year...So i tried to charge it but no LED lights opened..Even the power but
    14·1 answer
  • Which of these scenarios depicts unethical workplace practice by an employee?
    7·2 answers
  • A help desk manager needs to know the
    15·1 answer
  • I need help <br> Match each words with its definition!!!<br> Please helpppppppp
    12·1 answer
  • Which type of graph or chart measures
    15·2 answers
  • Use the drop-down menus to complete the statements about Outlook notes.
    8·1 answer
  • Could you please check my answers to this layout user defined data types
    15·1 answer
  • 2. 5s is a Chinese principle adapted for use in the workplace.<br>True or False​
    11·1 answer
  • Java Programming
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!