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
Part 2: a) Write VHDL code for a top module that invokes necessary components to display the four decimal digits on four seven-s
dimulka [17.4K]
I don’t know ‍♀️ sorry
7 0
2 years ago
How would you describe the difference between a syntax error and a logic error?
Ugo [173]

Answer:

hii

Explanation

syntax error:  a syntax error is an error in the syntax of a sequence of characters or tokens that is intended to be written in compile-time. A program will not compile until all syntax errors are corrected.

logic error:  logic error is a bug in a program that causes it to operate incorrectly, but not to terminate abnormally. A logic error produces unintended or undesired output or other behaviour, although it may not immediately be recognized as such.

6 0
3 years ago
Read 2 more answers
Which tables and fields would you access to determine which book titles have been purchased by a customer and when the order shi
enyata [817]

Answer:

To determine which book titles have been purchased by a customer and when the order shipped the following tables and fields would be used.

Table:      

  • CUSTOMERS

Fields

  • Customerno

Table

  • ORDERS

Fields:

  • Orderno
  • Shipdate
  • Customerno

Table:

  • ORDERITEMS

Fields:

  • Orderno

Table:

  • BOOKS

Fields

  • isbn
  • title

BOOKS table contains field like title of the books, so this will help in finding which book titles have been purchased.

CUSTOMERS table keeps information about customers that purchasing an ordering the books. The customerno uniquely identifies each customer so that the order information can be found using the customerno of a specific customer.

ORDERITEMS keeps information about orders via orderno

ORDERS table will keep track about the shipment of orders. Orderno identifies each order, shipdate will help determine when an order is shipped.

7 0
3 years ago
Examples of sound effects that can be used in video games and a cartoon
astraxan [27]
BOOM!, KAPOWW!, X%[email protected]*?!, SLAP, BOING, DING, ZZZZ, etc.
8 0
3 years ago
Andy wants to touch up his holiday photographs because they appear too bright and the color is washed out. Which software applic
Veronika [31]
The application andy wants to use is adobe photoshop 
5 0
3 years ago
Other questions:
  • Write a function getPigLatin(pigStr) that accepts pigStr as a parameter (a sentence as input) and converts each word to "Pig Lat
    8·1 answer
  • Write a program that prompts the user to enter the year and the first three letters of a month name (with the first letter in up
    8·1 answer
  • In which of the following situations may the taxpayer take an education expense on Schedule C? a. Henry, a self-employed adminis
    7·1 answer
  • What electronic device can represent a KiloByte?
    14·1 answer
  • BADM-Provide a reflection of at least 500 words (or 2 pages double spaced) of how the knowledge, skills, or theories of this cou
    7·1 answer
  • 20 POINTS!!! I NEED HELPP
    6·2 answers
  • Does anyone know this? Can someone please help me? I’ll give brainliest!!
    7·1 answer
  • Paisa pay is facilitated in which e commerce website​
    15·1 answer
  • The banner on the front page of a newsletter that identifies the publication is the:.
    11·1 answer
  • Which of the following is not a reason to choose a community college?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!