I am trying to possibly get this program to print out as.
Smith 1000 doe 1200 john 1400 bailey 900 potter 1600 the program itself has to arrays I either need to find out a way of possibly combining the two 1d arrays or just a way to format it correctly so it prints out in the above way.
The Program:
import java.util.*; public class TwoArrays { static Scanner console = new Scanner(System.in); public static void main(String[]args){ String [] name = new String[5]; int [] vote = new int[5]; String lastname; int votecount; int i; for(i=0; i<name.length; i++){ System.out.println("Enter the last name of the candidate: "); lastname = console.next(); name[i]= lastname; System.out.println("Enter the number of votes the candidate got: "); votecount = console.nextInt(); vote[i] = votecount; } String printing = Print(name); int printing2 = Print2(vote); } public static String Print(String [] pname){ for (int i=0; i<pname.length; i++){ System.out.println(pname[i]+ " \n"); } return "nothing"; } public static int Print2(int [] pvote){ for (int i=0; i<pvote.length; i++){ System.out.println(pvote[i]+ " \n"); } return 0; } }