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]
3 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]3 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]3 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
What is ‘Software Quality Assurance’?
Aleonysh [2.5K]

Answer: Software quality assurance is considered as the means under which one monitors the software processes and techniques used in order to ensure quality. The techniques using which this is attained are varied, and thus may also include ensuring accordance to more than one standards. It is referred to as a set of techniques that ensures the quality of projects in software process. These mostly include standards that administrators use in order to review and also audit software activities, i,e, these software meet standards.

5 0
3 years ago
In a mobile phone network, how many times as strong would
steposvetlana [31]

Answer:

how many times as strong would what?

put your question in the replies to this answer and I'll gladly answer it

Explanation:

May I have brainliest please? :)

6 0
3 years ago
While recording a voice, if the narration is large,it is better to make a :a)a linked object b)an embedded object c)none d)does
goldenfox [79]

Answer:

c)none

Explanation:

Automatic updates can be a great problem in the case of the linked object and an embedded object. Hence, "a" and "b" are not the correct options, and since there is an effect, the d. the option is also not correct, as it does affect. And hence none of these options are correct. And the correct option is c) none.

4 0
3 years ago
How do you change a automatic transmission
irinina [24]

Answer:

ohhh ok to all transactions.

6 0
3 years ago
1) These are operators that add and subtract one from their operands.
adoni [48]

Answer:

1) B (++ and --)

2) A (1 2 3 4 5)

Explanation:

In the first question, the operators ++ and -- are used in almost all programming languages for adding  and subtracting  1 respectively from an operand.

In the second question using a while statement the numbers 1-5 is printed out because the variable n=1 is increased by 1 after each iteration.

7 0
3 years ago
Other questions:
  • How come the UAC pops up EVERY TIME after i gave it permission to make changes to my PC
    6·1 answer
  • When you define a table's primary key, the dbms automatically creates a(n) _____ index on the primary key column(s) you declared
    14·1 answer
  • Bob has been assigned to set up a digital certificate solution for use with e-mail. One of the requirements he has been given is
    10·1 answer
  • Physical activity such as sports or even a brisk walk can help reduce
    7·2 answers
  • An important strategy in survey design involves the use of terms, phrases, and words that are known to both the PI team and resp
    9·1 answer
  • Place the steps in order for manually creating a New Contact Group
    10·2 answers
  • Which device do engineers use to drive a system of gears?
    15·2 answers
  • An informative presentation can be used for conducting a classroom discussion.
    6·1 answer
  • When adding new hardware, such as a printer, to a computer you often have to add associated software that allows the printer to
    6·1 answer
  • Write a program that calculates pay for either an hourly paid worker or a salaried worker Hourly paid workers are paid their hou
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!