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
emmasim [6.3K]
2 years ago
6

(Display characters) Write a method that prints characters using the following header: public static void printChars(char ch1, c

har ch2, int numberPerLine) This method prints the characters between ch1 and ch2 with the specified numbers per line. Write a test program that prints ten characters per line from 1 to Z. Characters are separated by exactly one space.
Computers and Technology
2 answers:
Butoxors [25]2 years ago
6 0

Answer:

Written in Java

public static void printChars(char ch1, char ch2, int numberPerLine){

        int i = 1;

        for(char A = ch1; A <= ch2; A++){

            if(i<=numberPerLine){

               System.out.print(A+" ");    

               i++;

            }

            else{

                System.out.println();

                i = 1;

            }

        }

    }

Explanation:

This line defines the method

public static void printChars(char ch1, char ch2, int numberPerLine){

This line initializes the number of print out per line to 1

        int i = 1;

The following is an iteration that prints from ch1 to ch2. Note that ch1 and ch2 are characters

        for(char A = ch1; A <= ch2; A++){

The following if condition (italicized) checks if the number of print outs is up to the required length.

If No, the character is printed

If yes, a new line is printed.

      <em>      if(i<=numberPerLine){</em>

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

<em>                i++;</em>

<em>             }</em>

<em>             else{</em>

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

<em>                 i = 1;</em>

<em>             }</em>

        }

    }

See attachment for full program including test of ten characters in a line

Download txt
Juli2301 [7.4K]2 years ago
5 0

public class MyClass {

   public static void printChar(char ch1, char ch2, int numberPerLine){

       int i = 0;

       for (char c = ch1; c <= ch2; c++){

           while (i < numberPerLine){

               System.out.print(c + " ");

               i += 1;

           }

           System.out.println("");

           i = 0;

       }

   }

   public static void main(String args[]) {

     printChar('a', 'z', 10);

   }

}

So far, this works by printing letters. If you need me to modify the code, I will.

You might be interested in
_____ regulate current/voltage flow, similar function as _____,but are smaller, cheaper, and more reliable.
Tpy6a [65]

Direct Current Power regulates current/voltage flow, similar function as unregulated or regulated, but is smaller, cheaper, and more reliable.

<h3>What is Direct Current Power?</h3>
  • In contrast to the flow of a river, direct current is a technique in which electricity constantly flows in the same direction. It speaks about the flow of electricity produced by batteries, solar cells, and other sources.
  • Alternating current (AC), on the other hand, is a technique in which the positive and negative sides are consistently swapped at regular intervals, changing the direction of the electricity flow in accordance.
  • This is the electricity that comes from a generator or a plug-in.
  • Alternating current is used to transmit both the electricity generated at power plants and the electricity delivered to houses.

To learn more about Direct Current Power, refer:

brainly.com/question/1402412

#SPJ4

8 0
2 years ago
A communication sent through Transmission Control Protocol (TCP) arrives out of order. What allows the data to be put back toget
algol13

Answer:

Error detection.

Explanation:

Tcp is a transport layer protocol. It is said to be connection oriented because it requires a handshake or established connection between the sender and the receiver.

Once a handshake is made, the segments of the packets are sent across and the connection is closed.

The error detection does not only carry out integrity checks, but allows for sequence numbering from the sender to receiver. If the packets arrives out of order, the sequence numbers are used to arrange them in the correct order.

5 0
3 years ago
4. What is the package name in which the Scanner class resides?
Ahat [919]
Related Articles. Scanner is a class in java. util package used for obtaining the input of the primitive types like int, double, etc. and strings.
7 0
3 years ago
A teacher wants to check the typing proficiency of five students. She gives all of them the same passage to type. Which student
Hitman42 [59]

The student who uses macros for long words. They are most likely to pass words very easily because they have a macro. While not only saving time, also making a stunning performance as macros usually auto correct as well.

5 0
2 years ago
For this question <br> Translate to assembly language!!!!!!!
svetoff [14.1K]

Answer:

Javascript, because of the use of commas at the end of each line and the while operator using commas to hold params.

6 0
3 years ago
Other questions:
  • Write a program that takes two ints as input from the keyboard, representing the number of hits and the number of at bats for a
    10·1 answer
  • to move from the second cell in the table in the accompanying figure back to the previous cell, press the ____ key(s)
    10·1 answer
  • How will you identify a file type on your computer? A file type is the standard used to and information in a computer. All file
    14·2 answers
  • In the Application, "The Effect of FDI on Rentals and Wages in Singapore," the annual growth rate in real rental rates for the 1
    5·1 answer
  • Bernard has a visual disability. Which type of assistive technology would he use to access print on the chalkboard or overhead s
    10·1 answer
  • A technician is buying a PC that will host three VMs running at the same time with the current configuration. The technician bel
    5·1 answer
  • Write a function definition for a function which takes one parameter and returns twice that parameter
    12·1 answer
  • New and just need help with C coding. I've tried if statements and it outputs the wrong number.
    6·2 answers
  • What types of company functions are aided by ERP?
    9·1 answer
  • you have been tasked with configuring a digital information station in the office's lobby. guests will be able to use the statio
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!