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
Lisa managed incident response for a bank. The bank has a website that’s been attacked. The attacker utilized the login screen,
Afina-wow [57]

Answer:

The attack is known as SQI Injection attack.

Explanation:

SQI injection usually exploit some security lapse in an application software for it to be able to work. It usually attack websites and mostly known as attack vector but may equally attack any type of SQL database of a company. These attacks allow attackers to steal and use identity, tamper with existing data on a system or website of the company or allow the complete disclosure of all data on the system. SQL Injection can also destroy the data or make it otherwise unavailable. Most importantly, it can become administrators of the database server or even cause reconciliation issues for such company transactions (e.g banks) such as voiding transactions or changing balances.

7 0
3 years ago
Write a do-while loop that continues to prompt a user to enter a number less than 100, until the entered number is actually less
OLEGan [10]

Answer:

#include <iostream>

using namespace std;

int main()

{

   int userInput = 0;

   do {

       cout << "Enter a number (<100):" << endl;

       cin >> userInput;

   }

   while(userInput >= 100);

   cout << "Your number < 100 is: " << userInput << endl;

   return 0;

}

Explanation:

Inside the <em>do part</em>, ask user to enter a number and get that number.

In the <em>while</em>, check if the number is greater than or equal to 100. It is going to keep asking to enter a number until a number that is smaller than 100 is entered.

Print out the number that is smaller than 100.

8 0
3 years ago
Read 2 more answers
How do media and networks interact
valkas [14]

Answer:

Media are connected to networks that make information easier to access and pass on.

7 0
3 years ago
Overview
ludmilkaskok [199]

Answer:

the answer is in the image below:

Explanation:

5 0
3 years ago
A musical time measurer is a(an)
Radda [10]
A musical timer is a metronome.
3 0
3 years ago
Other questions:
  • In a case where electrical current leakage from the circuit occurs,
    7·2 answers
  • It is important for a writter to include voice and point of view in writting because _______
    11·1 answer
  • Certain medications can increase risk of obtaining a sunburn true or false
    12·1 answer
  • Which segment of society introduced the grunge look?
    5·2 answers
  • PLEASE HELP!<br> How do you "brainliest" an answer?
    13·2 answers
  • In java
    6·1 answer
  • How do you fix this!!!!
    5·1 answer
  • Select the correct answer.
    9·1 answer
  • YASHARI earns $27,000 per year, is single, and lives in Wyoming. She has $7000 in Direct Subsidized loans and another $19,000 in
    9·1 answer
  • True or False? The background color block should be inserted after all the images are added.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!