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
MissTica
4 years ago
10

5-16) (Bar Chart Printing Program) One interesting application of computers is to display graphs and bar charts. Write an applic

ation that reads five numbers between 1 and 30. For each number that’s read, your program should display the same number of adjacent asterisks. For example, if your program reads the number 7, it should display *******. Display the bars of asterisks after you read all five numbers.
Computers and Technology
1 answer:
gavmur [86]4 years ago
8 0

Answer:

public class BarChartPrinting {

   

   public static void main (String [] args) {

       

       int numbers[] = new int[5];

       Scanner input = new Scanner(System.in);

       

       for (int i = 0; i < 5; i++){

           System.out.print("Enter a number between 1 to 30: ");

           numbers[i] = input.nextInt();

       }

       for (int i = 0; i < 5; i++){

           for (int j = 0; j < numbers[i]; j++){

               System.out.print("*");

           }

           System.out.println("");

       }

   }

}

Explanation:

- Initialize the <em>numbers</em> array to hold the numbers

- Inside the <u>for loop</u>, get the numbers from the user and put them in the <em>numbers</em>

- Inside the <em>nested for loop</em>, print the asterisks, depending on the number that is in the <em>numbers</em> array

The outer loop will iterate five times corresponding to the each number in the array, and inner loop will print the asterisks depending on the value of the number

You might be interested in
The set of specific, sequential steps that describe exactly what a computer program must do to complete the work is called a(n)
STatiana [176]

Answer:

algorithm

Explanation:

7 0
3 years ago
Kyle owns a growing delivery business. He would like to buy two more vans but first he needs to figure out related costs and his
guajiro [1.7K]

He will use a spreadsheet. hope this helped


4 0
4 years ago
Read 2 more answers
What is internet? explain help pliz​
m_a_m_a [10]

The Internet, sometimes called simply "the Net," is a worldwide system of computer networks -- a network of networks in which users at any one computer can, if they have permission, get information from any other computer (and sometimes talk directly to users at other computers).

3 0
3 years ago
Ok so this isn’t really a question that is for school but...
Nastasia [14]

Answer:

u shoud just keep it ;-;

Explanation:

5 0
3 years ago
How do you award a brainliest
erik [133]

Answer: Usually there has to be 2 answers. When you go to the answers on your question there should be a outlined crown or something like that, then you click that.

8 0
3 years ago
Read 2 more answers
Other questions:
  • In Asch’s study which of these lowered conformity rates
    7·2 answers
  • What advantage do ExpressCard modules and U.S.B adapters offer over expansion cards?
    10·1 answer
  • What is a service-oriented architecture? Group of answer choices A business-driven enterprise architecture that supports integra
    13·1 answer
  • Write the percentage 5 1/4 as a decimal​
    8·1 answer
  • Dillion’s company has decided it wants to find a way to do a better job of tracking clothing inventories. Dillon has been asked
    5·1 answer
  • Write a function called which_vowels_present that takes a single string parameter. Complete the function to return a list of str
    6·1 answer
  • Select the three business advantages of globalization.
    10·1 answer
  • What color and hat do you choose in Among Us
    15·1 answer
  • How did the invention of the printing press affect society?
    5·1 answer
  • The CUBE extension enables you to get a subtotal for each column listed in the expression, in addition to a grand total for the
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!