Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Answer in java CPS 180 - Lab Assignment #10 Assigned: 06/14/17 Due: 06/21/17 Poi

ID: 3849178 • Letter: A

Question

Answer in java

CPS 180 - Lab Assignment #10

Assigned: 06/14/17                     Due: 06/21/17                  Points: 40

Create a Java program to store the team standings for a NCAA MAC Conference game of your choice. Example: Last year’s mid-season, in-conference games played by the MAC (Mid-American Conference) NCAA football teams, utilizing the following 6 parallel arrays:

college, teamName, state, div, win, loss

Create the parallel arrays with the appropriate data types

Populate the arrays with the following data:

College

Team Name

State

Division

Win

Loss

0

Akron

Zips

OH

E

3

4

1

Ball State

Cardinals

IN

W

1

5

2

Bowling Green

Falcons

OH

E

1

5

3

Buffalo

Bulls

NY

E

1

5

4

Central Michigan

Chippewas

MI

W

2

4

5

Eastern Michigan

Eagles

MI

W

3

3

6

Kent State

Golden Flashes

OH

E

2

4

7

Miami

RedHawks

OH

E

5

2

8

Northern Illinois

Huskies

IL

W

3

3

9

Ohio

Bobcats

OH

E

5

1

10

Toledo

Rockets

OH

W

5

1

11

UMass

Minutemen

MA

E

0

4

12

Western Michigan

Broncos

MI

W

6

0

Output:

Generate a report of the entire data set as shown above, formatted into 7 columns, adding a calculated column (the 7th column) with the win percentage (wins/total games) stored in a variable winPct.

College          Team Name           State             Division         Win               Loss              Win %

Then, use methods and the same report format to generate 6 reports as follows. Create additional functions where you pass the array and any other parameter(s).

Display only the teams from MI

Display only the teams from OH

Display only the teams whose state starts with some letter of your choice

Display only the West division teams

Display the teams with exactly 3 wins

Display the team with the highest win percentage (find max of winPct)

This will require repeating the looping statement to generate the first list 4 more times, but using an if statement within the loop to determine whether or not to print the team based on the criteria above.

College

Team Name

State

Division

Win

Loss

0

Akron

Zips

OH

E

3

4

1

Ball State

Cardinals

IN

W

1

5

2

Bowling Green

Falcons

OH

E

1

5

3

Buffalo

Bulls

NY

E

1

5

4

Central Michigan

Chippewas

MI

W

2

4

5

Eastern Michigan

Eagles

MI

W

3

3

6

Kent State

Golden Flashes

OH

E

2

4

7

Miami

RedHawks

OH

E

5

2

8

Northern Illinois

Huskies

IL

W

3

3

9

Ohio

Bobcats

OH

E

5

1

10

Toledo

Rockets

OH

W

5

1

11

UMass

Minutemen

MA

E

0

4

12

Western Michigan

Broncos

MI

W

6

0

Explanation / Answer

copyable code:

public class Report {

public static void main(String[] args) {

String college[] = {"Akron", "Ball State", "Bowling Green", "Buffalo", "Central Michigan","Eastern Michigan", "Kent State", "Miami", "Northern Illinois", "Ohio","Toledo", "UMass", "Western Michigan"};

String team[] = {"Zips", "Cardinals", "Falcons", "Bulls", "Chippewas", "Eagles","Golden Flashes", "RedHawks", "Huskies", "Bobcats", "Rockets", "Minutemen", "Broncos"};

String state[] = {"OH", "IN", "OH", "NY", "MI","MI", "OH", "OH","IL", "OH","OH","MA","MI"};

char division[]={'E', 'W', 'E', 'E', 'W','W','E', 'E', 'W', 'E','W', 'E', 'W'};

int win[] = {3, 1, 1, 1, 2, 3, 2, 5, 3, 5, 5, 0, 6};

int loss[] = {4, 5, 5, 5, 4, 3, 4, 2, 3, 1, 1, 4, 0};   

double perwin[] = new double[win.length];
for(int i = 0; i < win.length; i++)
perwin[i] = win[i] * 100.0 / (win[i] + loss[i]);

System.out.println("*******************************");
System.out.println("Detailed report with WIN%");
System.out.println("*******************************");
System.out.printf(" %-30s %-20s %-10s %-10s %10s %10s %10s", "College", "Team", "State", "Division", "Win", "Loss", "Win %");
for(int i = 0; i < college.length; i++ )
{
System.out.printf(" %-30s %-20s %-10s %-10c %10d %10d %10.2f", college[i], team[i], state[i], division[i], win[i], loss[i], perwin[i]);
}

  

System.out.println(" ****************************");

System.out.println("Teams from MI");

System.out.println("******************************");

  

System.out.printf(" %-30s %-20s %-10s %-10s %10s %10s %10s", "College", "Team", "State", "Division", "Win", "Loss", "Win %");

for(int i = 0; i < college.length; i++ )

{

if(state[i].equals("MI"))

System.out.printf(" %-30s %-20s %-10s %-10c %10d %10d %10.2f", college[i], team[i], state[i], division[i], win[i], loss[i], perwin[i]);

}

  

System.out.println(" ******************************");

System.out.println("Teams from OH");

System.out.println("*********************************");

  

System.out.printf(" %-30s %-20s %-10s %-10s %10s %10s %10s", "College", "Team", "State", "Division", "Win", "Loss", "Win %");

for(int i = 0; i < college.length; i++ )

{

if(state[i].equals("OH"))

System.out.printf(" %-30s %-20s %-10s %-10c %10d %10d %10.2f", college[i], team[i], state[i], division[i], win[i], loss[i], perwin[i]);

}

  

System.out.println(" ********************************");

System.out.println("Teams from state with I");

System.out.println("**********************************");

  

System.out.printf("%-30s %-20s %-10s %-10s %10s %10s %10s", "College", "Team", "State", "Division", "Win", "Loss", "Win %");

for(int i = 0; i < college.length; i++ )

{

if(state[i].startsWith("I"))

System.out.printf(" %-30s %-20s %-10s %-10c %10d %10d %10.2f", college[i], team[i], state[i], division[i], win[i], loss[i], perwin[i]);

}

  

System.out.println(" *****************************");

System.out.println("Western division teams");

System.out.println("*******************************");

  

System.out.printf("%-30s %-20s %-10s %-10s %10s %10s %10s", "College", "Team", "State", "Division", "Win", "Loss", "Win %");

for(int i = 0; i < college.length; i++ )

{

if(division[i] == 'W')

System.out.printf(" %-30s %-20s %-10s %-10c %10d %10d %10.2f", college[i], team[i], state[i], division[i], win[i], loss[i], perwin[i]);

}

  

System.out.println(" *********************************");

System.out.println("Teams with exactly 3 Wins");

System.out.println("***********************************");

  

System.out.printf("%-30s %-20s %-10s %-10s %10s %10s %10s", "College", "Team", "State", "Division", "Win", "Loss", "Win %");

for(int i = 0; i < college.length; i++ )

{

if(win[i] == 3)

System.out.printf(" %-30s %-20s %-10s %-10c %10d %10d %10.2f", college[i], team[i], state[i], division[i], win[i], loss[i], perwin[i]);

}

  

//find team with highest win percentage

int tmp = 0;

for(int i = 1; i < perwin.length; i++)

{

if(perwin[i] > perwin[tmp])

tmp = i;

}

  

System.out.println(" **********************************");

System.out.println("Team with hightest win % is ");

System.out.println("************************************");

System.out.printf(" %-30s %-20s %-10s %-10c %10d %10d %10.2f", college[tmp], team[tmp], state[tmp], division[tmp], win[tmp], loss[tmp], perwin[tmp]);

  

}

}

output:

C:UsersRaviDesktopsel1>javac Report.java

C:UsersRaviDesktopsel1>java Report
*******************************
Detailed report with WIN%
*******************************

College Team State Division
Win Loss Win %
Akron Zips OH E
3 4 42.86
Ball State Cardinals IN W
1 5 16.67
Bowling Green Falcons OH E
1 5 16.67
Buffalo Bulls NY E
1 5 16.67
Central Michigan Chippewas MI W
2 4 33.33
Eastern Michigan Eagles MI W
3 3 50.00
Kent State Golden Flashes OH E
2 4 33.33
Miami RedHawks OH E
5 2 71.43
Northern Illinois Huskies IL W
3 3 50.00
Ohio Bobcats OH E
5 1 83.33
Toledo Rockets OH W
5 1 83.33
UMass Minutemen MA E
0 4 0.00
Western Michigan Broncos MI W
6 0 100.00
****************************
Teams from MI
******************************

College Team State Division
Win Loss Win %
Central Michigan Chippewas MI W
2 4 33.33
Eastern Michigan Eagles MI W
3 3 50.00
Western Michigan Broncos MI W
6 0 100.00
******************************
Teams from OH
*********************************

College Team State Division
Win Loss Win %
Akron Zips OH E
3 4 42.86
Bowling Green Falcons OH E
1 5 16.67
Kent State Golden Flashes OH E
2 4 33.33
Miami RedHawks OH E
5 2 71.43
Ohio Bobcats OH E
5 1 83.33
Toledo Rockets OH W
5 1 83.33
********************************
Teams from state with I
**********************************
College Team State Division
Win Loss Win %
Ball State Cardinals IN W
1 5 16.67
Northern Illinois Huskies IL W
3 3 50.00
*****************************
Western division teams
*******************************
College Team State Division
Win Loss Win %
Ball State Cardinals IN W
1 5 16.67
Central Michigan Chippewas MI W
2 4 33.33
Eastern Michigan Eagles MI W
3 3 50.00
Northern Illinois Huskies IL W
3 3 50.00
Toledo Rockets OH W
5 1 83.33
Western Michigan Broncos MI W
6 0 100.00
*********************************
Teams with exactly 3 Wins
***********************************
College Team State Division
Win Loss Win %
Akron Zips OH E
3 4 42.86
Eastern Michigan Eagles MI W
3 3 50.00
Northern Illinois Huskies IL W
3 3 50.00
**********************************
Team with hightest win % is
************************************

Western Michigan Broncos MI W
6 0 100.00
C:UsersRaviDesktopsel1>

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote