I am trying to figure out how many entries can be read from the scanner class in Java. I need to get the names of every person I enter and then compare the total amount of each entry.
This is my code:
string [] salespersons = new string [3]; System.out.println ("To compare sales, please enter at least two sales, but not more than four,"); // user scanner input = use scanner class to read input from new scanner (System.in); String line = input NXtine (); String [] values = line.split (","); (For string: value) {salespersons = value; }
For some reasons, I can not get the values that are kept in the vendors. (I'm really new in java, sorry if my question does not understand a lot).
You can just type:
salespersons = line.split (",");
You do not have to allocate it to intermediate values, and then loop on it to provide to sellers. But if you want to do this, you should index it for loop:
(int i = 0; i
No comments:
Post a Comment