not allowed to use methods, in Java that does a list of things and Im struggling. I
Question:
not allowed to use methods, in Java that does a list of things and Im struggling. I have to use arrays, but not array lists. I have a text file formatted like so:
Player Most Passing yards Tom Brady 80560 Drew Brees 80358 Peyton Manning 71940 Brett Favre 71838 Phillip Rivers 63440 Ben Roethlisberger 61381 Dan Marino 61361 Eli Manning 57023 Matt Ryan 56757 Aaron Rogers 54142
I need Java to print the following things
1- The players in order from highest passing yards with both name and yard amount.
2- The players in order from lowest passing yards with both name and yard amount
3- average passing yards
4- players who have passing yards over 65,000 yards.
what I have so far
import java.io.File; import java.io.FileNotFoundException; import java.util.Arrays; import java.util.Scanner; public class football { public static void main(String[] args) throws FileNotFoundException{ Scanner sc = new Scanner(new File("/Users/Downloads/football.txt")); String [] players = new String[sc.nextLine()]; for (int i =0; i < players.length; i++){ players[i] = sc.nextLine(); } for (String line : players){ System.out.println(line); } } }
Management Accounting
ISBN: 978-0132570848
6th Canadian edition
Authors: Charles T. Horngren, Gary L. Sundem, William O. Stratton, Phillip Beaulieu