1. package fantasyFootball; 2 import java.util.Scanner; 4 public class FantasyFootball { private int numberofTeams; //same as teamAverage. length private int numberofWeeks; //same as weekAverage.lenght private int[[] scores; //number of teams rows & number of weeks columns private double[] weekAverage; // contains an entry for each week private double[] teamAverage; // contains an entry for each team private String [] teamName; // contains an entry for each team 6. 8. 9. 10 11 12 13 14- public void enterInDate ( 15 16 Scanner keyboard = new Scanner(System.in); System.out.println ("Enter number of team:"); numberofTeams = keyboard.nextInt(); 17 18 19 20 System.out.println ("Enter number of weeks:"); numberofWeeks = keyboard.nextInt(); 21 22 //String teamName []=new String [number0fTeams]; //int scores[][]=new int [number0fTeams] [number0fWeeks]; 23 24 25 //allocate array memory for teamName to store the team names //allocate array memory for scores (2-d array) to store a //score for each team for each week 26 27 28 29 for (int team = 0; team < numberofTeams; team++) { System.out.println("Enter team name"); 30 31 32 33 34 //Read in team name and store it in TeamName 35 String name=keyboard.nextLine (); teamName [team]=name; for (int week = 0; week < number0fWeeks; week++) 36 37 38 39 System.out.println("Enter score for team "+teamName [team]); System.out.println("on week number "+(week+1)); //read in a score and store it in the proper spot in the scores array int score=keyboard.nextInt(); scores[team] [week]=score; 40 42 43 44 45 46 47 48 - public void fillTeamAverage() 49 //allocate memory for the teamAverage //each entry in this array will contain the //average weekly score for a given team //double teamAverage[]=new double [number0fTeams] for (int team=0; team < number0fTeams; team++) 50 51 52 53 54 55 int sum=0; double average=0.0; for (int week =0; week < numberofWeeks; week++) 56 57 58 59 sum=sum+scores [team] [week]; 60 61 average=sum/number0fWeeks; teamAverage [team]=average; 62 63 64 65 66 - 67 68 public void fillweekAverage() //Allocate memory for the weekAverage instance variable //each entry in this array will contain the average of //all teams for a given week 69 70 71 72 //double weekAverage []=new double [number0fTeams]; 73 74 for (int week = 0; week < numberofWeeks; week++) 75 int sum = 0; double average = 0.0; for (int team = 0; team < numberofTeams; team++) 76 77 78 79 80 sum = sum + scores [team] [week]; 81 82 83 84 average=sum/number0fTeams; weekAverage [number0fWeeks]=average; 85 86 - 87 public void display() //this method will print out the display that was shown above //at this point all of the information can be found in the //private instance variables of the FantasyFootball class System.out.print ("Team Name"); 88 89 90 91 System.out.print('\t'); int i=0, j=0; while(i
1. package fantasyFootball; 2 import java.util.Scanner; 4 public class FantasyFootball { private int numberofTeams; //same as teamAverage. length private int numberofWeeks; //same as weekAverage.lenght private int[[] scores; //number of teams rows & number of weeks columns private double[] weekAverage; // contains an entry for each week private double[] teamAverage; // contains an entry for each team private String [] teamName; // contains an entry for each team 6. 8. 9. 10 11 12 13 14- public void enterInDate ( 15 16 Scanner keyboard = new Scanner(System.in); System.out.println ("Enter number of team:"); numberofTeams = keyboard.nextInt(); 17 18 19 20 System.out.println ("Enter number of weeks:"); numberofWeeks = keyboard.nextInt(); 21 22 //String teamName []=new String [number0fTeams]; //int scores[][]=new int [number0fTeams] [number0fWeeks]; 23 24 25 //allocate array memory for teamName to store the team names //allocate array memory for scores (2-d array) to store a //score for each team for each week 26 27 28 29 for (int team = 0; team < numberofTeams; team++) { System.out.println("Enter team name"); 30 31 32 33 34 //Read in team name and store it in TeamName 35 String name=keyboard.nextLine (); teamName [team]=name; for (int week = 0; week < number0fWeeks; week++) 36 37 38 39 System.out.println("Enter score for team "+teamName [team]); System.out.println("on week number "+(week+1)); //read in a score and store it in the proper spot in the scores array int score=keyboard.nextInt(); scores[team] [week]=score; 40 42 43 44 45 46 47 48 - public void fillTeamAverage() 49 //allocate memory for the teamAverage //each entry in this array will contain the //average weekly score for a given team //double teamAverage[]=new double [number0fTeams] for (int team=0; team < number0fTeams; team++) 50 51 52 53 54 55 int sum=0; double average=0.0; for (int week =0; week < numberofWeeks; week++) 56 57 58 59 sum=sum+scores [team] [week]; 60 61 average=sum/number0fWeeks; teamAverage [team]=average; 62 63 64 65 66 - 67 68 public void fillweekAverage() //Allocate memory for the weekAverage instance variable //each entry in this array will contain the average of //all teams for a given week 69 70 71 72 //double weekAverage []=new double [number0fTeams]; 73 74 for (int week = 0; week < numberofWeeks; week++) 75 int sum = 0; double average = 0.0; for (int team = 0; team < numberofTeams; team++) 76 77 78 79 80 sum = sum + scores [team] [week]; 81 82 83 84 average=sum/number0fTeams; weekAverage [number0fWeeks]=average; 85 86 - 87 public void display() //this method will print out the display that was shown above //at this point all of the information can be found in the //private instance variables of the FantasyFootball class System.out.print ("Team Name"); 88 89 90 91 System.out.print('\t'); int i=0, j=0; while(i
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
hello! can you help me debug my
line 126: the method newFantasyFootball is undefined for the type FantasyFootball
line 127: the method enterInData is undefined for the type FantasyFootball
![1.
package fantasyFootball;
2
import java.util.Scanner;
4
public class FantasyFootball
{
private int numberofTeams; //same as teamAverage. length
private int numberofWeeks; //same as weekAverage.lenght
private int[[] scores; //number of teams rows & number of weeks columns
private double[] weekAverage; // contains an entry for each week
private double[] teamAverage; // contains an entry for each team
private String [] teamName; // contains an entry for each team
6.
8.
9.
10
11
12
13
14-
public void enterInDate (
15
16
Scanner keyboard = new Scanner(System.in);
System.out.println ("Enter number of team:");
numberofTeams = keyboard.nextInt();
17
18
19
20
System.out.println ("Enter number of weeks:");
numberofWeeks = keyboard.nextInt();
21
22
//String teamName []=new String [number0fTeams];
//int scores[][]=new int [number0fTeams] [number0fWeeks];
23
24
25
//allocate array memory for teamName to store the team names
//allocate array memory for scores (2-d array) to store a
//score for each team for each week
26
27
28
29
for (int team = 0; team < numberofTeams; team++)
{
System.out.println("Enter team name");
30
31
32
33
34
//Read in team name and store it in TeamName
35
String name=keyboard.nextLine ();
teamName [team]=name;
for (int week = 0; week < number0fWeeks; week++)
36
37
38
39
System.out.println("Enter score for team "+teamName [team]);
System.out.println("on week number "+(week+1));
//read in a score and store it in the proper spot in the scores array
int score=keyboard.nextInt();
scores[team] [week]=score;
40
42
43
44
45
46
47
48 -
public void fillTeamAverage()
49
//allocate memory for the teamAverage
//each entry in this array will contain the
//average weekly score for a given team
//double teamAverage[]=new double [number0fTeams]
for (int team=0; team < number0fTeams; team++)
50
51
52
53
54
55
int sum=0;
double average=0.0;
for (int week =0; week < numberofWeeks; week++)
56
57
58
59
sum=sum+scores [team] [week];
60
61
average=sum/number0fWeeks;
teamAverage [team]=average;
62
63
64
65
66 -
67
68
public void fillweekAverage()
//Allocate memory for the weekAverage instance variable
//each entry in this array will contain the average of
//all teams for a given week
69
70
71
72
//double weekAverage []=new double [number0fTeams];
73
74
for (int week = 0; week < numberofWeeks; week++)
75
int sum = 0;
double average = 0.0;
for (int team = 0; team < numberofTeams; team++)
76
77
78
79
80
sum = sum + scores [team] [week];
81
82
83
84
average=sum/number0fTeams;
weekAverage [number0fWeeks]=average;
85
86 -
87
public void display()
//this method will print out the display that was shown above
//at this point all of the information can be found in the
//private instance variables of the FantasyFootball class
System.out.print ("Team Name");
88
89
90
91](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F105a6b10-1479-49f6-854d-b98a0aa319bf%2Fa0b3a848-fa69-42f8-91b9-887bfbebc528%2F0h4i0u.png&w=3840&q=75)
Transcribed Image Text:1.
package fantasyFootball;
2
import java.util.Scanner;
4
public class FantasyFootball
{
private int numberofTeams; //same as teamAverage. length
private int numberofWeeks; //same as weekAverage.lenght
private int[[] scores; //number of teams rows & number of weeks columns
private double[] weekAverage; // contains an entry for each week
private double[] teamAverage; // contains an entry for each team
private String [] teamName; // contains an entry for each team
6.
8.
9.
10
11
12
13
14-
public void enterInDate (
15
16
Scanner keyboard = new Scanner(System.in);
System.out.println ("Enter number of team:");
numberofTeams = keyboard.nextInt();
17
18
19
20
System.out.println ("Enter number of weeks:");
numberofWeeks = keyboard.nextInt();
21
22
//String teamName []=new String [number0fTeams];
//int scores[][]=new int [number0fTeams] [number0fWeeks];
23
24
25
//allocate array memory for teamName to store the team names
//allocate array memory for scores (2-d array) to store a
//score for each team for each week
26
27
28
29
for (int team = 0; team < numberofTeams; team++)
{
System.out.println("Enter team name");
30
31
32
33
34
//Read in team name and store it in TeamName
35
String name=keyboard.nextLine ();
teamName [team]=name;
for (int week = 0; week < number0fWeeks; week++)
36
37
38
39
System.out.println("Enter score for team "+teamName [team]);
System.out.println("on week number "+(week+1));
//read in a score and store it in the proper spot in the scores array
int score=keyboard.nextInt();
scores[team] [week]=score;
40
42
43
44
45
46
47
48 -
public void fillTeamAverage()
49
//allocate memory for the teamAverage
//each entry in this array will contain the
//average weekly score for a given team
//double teamAverage[]=new double [number0fTeams]
for (int team=0; team < number0fTeams; team++)
50
51
52
53
54
55
int sum=0;
double average=0.0;
for (int week =0; week < numberofWeeks; week++)
56
57
58
59
sum=sum+scores [team] [week];
60
61
average=sum/number0fWeeks;
teamAverage [team]=average;
62
63
64
65
66 -
67
68
public void fillweekAverage()
//Allocate memory for the weekAverage instance variable
//each entry in this array will contain the average of
//all teams for a given week
69
70
71
72
//double weekAverage []=new double [number0fTeams];
73
74
for (int week = 0; week < numberofWeeks; week++)
75
int sum = 0;
double average = 0.0;
for (int team = 0; team < numberofTeams; team++)
76
77
78
79
80
sum = sum + scores [team] [week];
81
82
83
84
average=sum/number0fTeams;
weekAverage [number0fWeeks]=average;
85
86 -
87
public void display()
//this method will print out the display that was shown above
//at this point all of the information can be found in the
//private instance variables of the FantasyFootball class
System.out.print ("Team Name");
88
89
90
91
![System.out.print('\t');
int i=0, j=0;
while(i<numberofWeeks)
92
93
94
95
System.out.print("Team"+(i+1));
System.out.print('\t');
i++;
System.out.println();
i=0;
while(i<number0fTeams)
{
System.out.print (teamName [i]);
System.out.print ('\t');
j=0;
while(j<number0fWeeks)
{
System.out.print (scores [i]);
System.out.println();
i+t;
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
j=0;
System.out.print ("Weekly Avg");;
System.out.print ('\t');;
while(j<number0fWeeks)
112
113
114
115
116
117
118
System.out.print((int)weekAverage [j]);
System.out.print('\t');;
j++;
119
120
121
122
123
124
125
126
127
128
public static void maind (String[] args)
FantasyFootball f= newFantasyFootball();
f.enterInData();
f.fillTeamAverage ();
f.fillweekAverage ();
129
130
131
f.display();
132
133](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F105a6b10-1479-49f6-854d-b98a0aa319bf%2Fa0b3a848-fa69-42f8-91b9-887bfbebc528%2Fdm5uf5m.png&w=3840&q=75)
Transcribed Image Text:System.out.print('\t');
int i=0, j=0;
while(i<numberofWeeks)
92
93
94
95
System.out.print("Team"+(i+1));
System.out.print('\t');
i++;
System.out.println();
i=0;
while(i<number0fTeams)
{
System.out.print (teamName [i]);
System.out.print ('\t');
j=0;
while(j<number0fWeeks)
{
System.out.print (scores [i]);
System.out.println();
i+t;
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
j=0;
System.out.print ("Weekly Avg");;
System.out.print ('\t');;
while(j<number0fWeeks)
112
113
114
115
116
117
118
System.out.print((int)weekAverage [j]);
System.out.print('\t');;
j++;
119
120
121
122
123
124
125
126
127
128
public static void maind (String[] args)
FantasyFootball f= newFantasyFootball();
f.enterInData();
f.fillTeamAverage ();
f.fillweekAverage ();
129
130
131
f.display();
132
133
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education