Hi I need help debugging this code in JAVA! Need to stop my while loop from running after a certain number of lines when the
Hi I need help debugging this code in JAVA! Need to stop my while loop from running after a certain number of lines when the input from console ends. Currently it is in an infinite loop in while and I've tried a few things to stop after the lines are done but i just cant figure it out :/
FINAL CODE: Should take input and output row with *'s in the row of how many of that letter was found in all lines of code. I figured out how to do most of the code, but it only worked for one line!! So stuck on this, thank you for the help!
EXAMPLE INPUT:
aaaabbbb ccc&%
xxyyyyy zz eee
package histogram; import java.util.*; //import java.Lang.Math public class Histogram2 public static void main(String [] args) Scanner scnrnew Scanner(System.in); int[l numStars new int [26]; while(scnr.hasNextLine()) //Scanner lineScanner -new Scanner(scnr.nextLine)) char[] input scnr.nextLine().toCharArray); /ADD STARS for (char scanInput: input) if (scanInput 97 && scanInputStep by Step Solution
There are 3 Steps involved in it
Step: 1
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started