Home / Expert Answers / Computer Science / help-please-use-violetuml-to-draw-a-uml-class-diagram-that-shows-the-relationship-among-the-classe-pa308

(Solved): help please Use VioletUML to draw a UML class diagram that shows the relationship among the classe ...



Use VioletUML to draw a UML class diagram that shows the relationship among the classes below.
Note that, as in any program dpublic abstract class Train \{
private int number;
private int numberofCars;
public Train( int number ) \{
this.number = numbpublic class PassengerTrain extends Train \{
private ArrayList \( < \) Passenger> passengers;
public PassengerTrain(int numbehelp please

Use VioletUML to draw a UML class diagram that shows the relationship among the classes below. Note that, as in any program design, there may be multiple choices for relationships between some classes. In such a case, select only the most 1. Draw your UML diagram 2. Submit only the UML diagram file, named with your UTSA ID (abc123.png an image) To submit your response: 1. Save your UML diagram as an image file. - In VioletUML, to save as an image, go to File > Export > Image. This will save as a .png 2. Name that file abc123.png (where abc123 is your UTSA ID) 3. Upload the image file only to Blackboard here. *NOTE: submissions which are not image files will receive 0 credit import java util.ArrayList; public class Station \{ private ArrayList Train trains; public Station() \{ this.trains = new ArrayList Train ; \} public ArrayList Train getTrains return this.trains; \} \} public abstract class Train \{ private int number; private int numberofCars; public Train( int number ) \{ this.number = number; \} public int getNumberOfCars() \{ return this numberofCars; public void setNumber( int newTrainNumber ) \{ this.number = newTrainNumber; \} import java util.ArrayList; public class PassengerTrain extends Train \{ private ArrayList Passenger passengers; public PassengerTrain(int number) \{ super(number); \} public int getNumberOfPassengers() \{ return this passengers.size(); \} \} public class Passenger \{ private boolean hasTicket; private String ticketNumber; public class PassengerTrain extends Train \{ private ArrayList Passenger> passengers; public PassengerTrain(int number) \{ super(number); public int getNumberOfPassengers() \{ return this.passengers.size(); \} public class Passenger \{ private boolean hasticket; private String ticketNumber: public Passenger() \{ this.hasTicket false; \} public Passenger( String ticket ) \{ this.ticketNumber ticket ; this.hasTicket true; \} \}


We have an Answer from Expert

View Expert Answer

Expert Answer



First, we have one class: Station. It has one attribute: trains, which is an ArrayList of Train objects. It also has one method: getTrains(), which returns the trains attribute.
So our Station class will have one association with the Train class, with the multiplicity of 0..* on the Station end and 1 on the Train end. The Station class will also have one method: getTrains(), which returns an ArrayList of Train objects.
Here's what the UML class diagram should look like:
___________________________________
| Station |
|-----------------------------------|
| - trains: ArrayList |
|-----------------------------------|
| + getTrains(): ArrayList |
-----------------------------------
|
|
|
|
0..* 1
------->------
| |
| Train |
| |
------->------
Remember to export your diagram as an image file (e.g. abc123.png) and submit it according to the instructions given.
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe