#C14919. Fruit Bar Chart Visualization
Fruit Bar Chart Visualization
Fruit Bar Chart Visualization
You are given a list of fruits and their respective quantities. Your task is to generate a horizontal bar chart in a textual format. Each line of the output should contain the fruit name, followed by a colon and a space, then a number of asterisks (*) that represent the fruit’s quantity scaled by a factor of 5.
For a given fruit with quantity Q, the number of asterisks is determined by \(\lfloor Q/5 \rfloor\). However, if \(\lfloor Q/5 \rfloor\) is 0 (i.e. for small quantities), output at least one asterisk.
The order of the fruits in the output should be the same as the order in which they are provided in the input.
Input Format: The first line contains an integer N, representing the number of fruits. The following N lines each contain a fruit name and an integer quantity separated by a space.
Output Format: For each fruit, output a line in the format:
[ \texttt{FruitName: ********}]
where the number of asterisks is equal to \(\max(1, \lfloor Q/5 \rfloor)\).
inputFormat
The first line of input is an integer N (the number of fruits). Each of the next N lines contains a string (the fruit name) and an integer (the fruit quantity) separated by a space.
outputFormat
For each fruit, output a line containing the fruit name, a colon, a space, and a bar made of asterisks (*) where the number of asterisks is computed as \(\max(1, \lfloor Q/5 \rfloor)\) for the given quantity Q.
## sample5
Apple 50
Banana 75
Cherry 45
Date 30
Grape 90
Apple: **********
Banana: ***************
Cherry: *********
Date: ******
Grape: ******************
</p>