Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a UML diagram for the following .java NFL classes. public class NFLPlayer { private int id ; private String name; private String address; public

Create a UML diagram for the following .java NFL classes.

public class NFLPlayer {

private int id ;

private String name;

private String address;

public NFLPlayer() {

// TODO Auto-generated constructor stub

}

public NFLPlayer(int id, String name, String address) {

super();

this.id = id;

this.name = name;

this.address = address;

}

public int getId() {

return id;

}

public void setId(int id) {

this.id = id;

}

public String getName() {

return name;

}

public void setName(String name) {

this.name = name;

}

public String getAddress() {

return address;

}

public void setAddress(String address) {

this.address = address;

}

@Override

public String toString() {

return "NFLPlayer [id=" + id + ", name=" + name + ", address=" + address + "]";

}

}

-------------------------------------------------------------------------------------------------------------------------------

import java.util.ArrayList;

import java.util.List;

//This class is used to create , display and manage NFLPlayers

public class NFLPlayerManager {

//List of NFLPlayers

private List list=null;

public NFLPlayerManager() {

list=new ArrayList<>();

}

//This method creates atleast 6 players of Type NFLPlayer

public void createPlayers(){

NFLPlayer player1=new NFLPlayer();

player1.setId(1);

player1.setName("John");

player1.setAddress("California");

NFLPlayer player2=new NFLPlayer();

player2.setId(2);

player2.setName("Peter");

player2.setAddress("New Southwales");

NFLPlayer player3=new NFLPlayer();

player3.setId(3);

player3.setName("Harry");

player3.setAddress("New Zealand");

NFLPlayer player4=new NFLPlayer();

player4.setId(4);

player4.setName("Kevin");

player4.setAddress("California");

NFLPlayer player5=new NFLPlayer();

player5.setId(5);

player5.setName("Johnny");

player5.setAddress("London");

NFLPlayer player6=new NFLPlayer();

player6.setId(6);

player6.setName("Andrew");

player6.setAddress("Korea");

list.add(player1);

list.add(player2);

list.add(player3);

list.add(player4);

list.add(player5);

list.add(player6);

}

//This method is used to dislay all 6 players

public void driver(){

for (NFLPlayer nflPlayer : list) {

System.out.println("Player id :"+nflPlayer.getId()+" Name :"+nflPlayer.getName()+" Address :"+nflPlayer.getAddress());

}

}

@Override

public String toString() {

return "NFLPlayerManager [list=" + list + "]";

}

public static void main(String[] args) {

NFLPlayerManager manager=new NFLPlayerManager();

manager.createPlayers();

manager.driver();

}

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Inductive Databases And Constraint Based Data Mining

Authors: Saso Dzeroski ,Bart Goethals ,Pance Panov

2010th Edition

1489982175, 978-1489982179

More Books

Students also viewed these Databases questions