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.
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); } } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
To achieve the desired functionality without using methods you can follow these steps 1 Read the dat...Get Instant Access to Expert-Tailored Solutions
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