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
Question No. 5:
Mkey [24]

Answer:

The answers are:

a) (1001111)_2 = (79 )_{10}\\b) (11000001)_2 = (C1 )_{16}\\c) (E16)_{16} = ( 3606)_{10}\\d) (56)_{10} = (38 )_{16}\\e) (63)_{10}= (111111 )_2

Explanation:

<u>a. (1001111) 2 = ( ) 10</u>

In order to convert a base 2 number to base 10 number system the place values are used.

the procedure is as follows:

(1001111)_2\\=(1*2^6)+(0*2^5)+(0*2^4)+(1*2^3)+(1*2^2)+(1*2^1)+(1*2^0)\\=(1*64)+(0*32)+(0*16)+(1*8)+(1*4)+(1*2)+(1*1)\\=64+0+0+8+4+2+1\\=79

<u>b) (11000001) 2 = ( ) 16</u>

In order to convert a base 2 number into base 16, group of 4-bits are made starting from right to left

The groups from the given number are:

1100 0001

Then the groups are changed in to decimal/hexa

So,

(1100)_2 = (1*2^3)+(1*2^2)+(0*2^1)+(0*2^0)\\=(1*8)+(1*4)+(0*2)+(0*1)\\=8+4+0+0=12=C\\\\0001=1

Writing in the same order in which groups were:

(C1)_{16}

<u>c) (E16) 16 = ( ) 10</u>

(E16)_{16}\\=(E*16^2)+(1*16^1)+(6*16^0)\\=(E*256)+(1*16)+(6*1)\\=3584+16+6\\=3606

<u>d) (56) 10 = ( ) 16</u>

Dividing by 16 and noting remainders

16        56

           3 - 8

So,

The number in base 16 is 38

<u>e) (63) 10 = ( ) 2</u>

Dividing by 2

2         63

2         31 - 1

2         15 - 1

2          7 -  1

2          3 -  1

            1 - 1

So the  number after converting in base 2 is:

111111

Hence,

The answers are:

a) (1001111)_2 = (79 )_{10}\\b) (11000001)_2 = (C1 )_{16}\\c) (E16)_{16} = ( 3606)_{10}\\d) (56)_{10} = (38 )_{16}\\e) (63)_{10}= (111111 )_2

8 0
3 years ago
FILL IN THE BLANK...............
gizmo_the_mogwai [7]
<span>Latif wants to frame one of his photographs. He wants to use the MATTED framing style where the mat keeps the glass and photo apart.

It is one of the most common framing styles: the back mat and photo corners help keep the photo flattened, while the front mat keeps the photo from touching the glass. This style also makes it easy to transfer the work into and out of the frame. </span>
4 0
3 years ago
A proxy is
salantis [7]

Answer:

C. an authorization of a registered stockholder to another person to act in their place at the meeting

Explanation:

  • The proxy server acts as a gateway between you and the Internet.
  • it is a Intermediate Server separates users from browsing websites
  • Therefore, the proxy here refers to allowing someone to act on their behalf. In the case of the company, the proxy allows another person to act on behalf of the registered stockholder at company meetings.
4 0
3 years ago
Question #8
White raven [17]

Answer:

The other person is correct the answer is 7

Explanation:

I got it right on edge

3 0
3 years ago
In a proper webpage, which tag holds all of a webpages visible HTML?
Evgen [1.6K]

Body.


head contains all of the data that we generally don't see.


Link is used to link to external stylesheets.


script is where you would type scrips.


doctype is used to tell the browser the document type.

6 0
3 years ago
Other questions:
  • What policy definition can help remind employees in the User Domain about what constitutes suitable use and improper use of corp
    14·1 answer
  • The internet is a worldwide assembly of computer
    11·1 answer
  • The domain in an email message tells you what?
    11·1 answer
  • Which type of storage disk and disk drive can be used in the given situation? Amy wants to borrow an interesting movie from Bruc
    10·2 answers
  • after clicking the start button on your computer screen desktop what option would you then select to examine systems components
    6·1 answer
  • Andrew works for a company that develops for a company that develops optic-fiber cables for transmission of data. which layer of
    14·1 answer
  • Explain by details operator overloading in C++ with example
    6·1 answer
  • How much heat is needed to raise the temperature of 7g of water by 15oC?
    6·1 answer
  • A local company is expanding its range from one state to fifteen states. They will need an advanced method of online communicati
    9·2 answers
  • n (m,n) correlating branch predictor uses the behavior of the most recent m executed branches to choose from 2m predictors, each
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!