我需要找到收入最高的公司。
到目前为止,我能够从循环中提取最高的总收益,但不知道如何获得与最高收益相关的公司名称。
而(计数<= noOfComp)
{
System.out.print("Enter Company: ");
companyName = kb.nextLine();
System.out.print("Number of hires: ");
noOfHires = kb.nextInt();
kb.nextLine();
//calculations
totalEarnings = noOfHires * 2500 + 10000;
System.out.println("Total Earnings of company is :" + totalEarnings);
totalEarned = "" + totalEarnings;
if(totalEarnings > large ) //If statement for largest number
{
large = totalEarnings;
}
allTotalEarnings += totalEarnings;
count++;
}