Question

Open Visual Paradigm for UML.

File | New Project. Set the Project name to {FLname}MyCompanyDesign, where {FLname} is replaced by the first letter of your first name plus your last name. E.g. if your name is Maria Marciano, your project name must be MMarcianoMyCompanyDesign. Click the Create Blank Project button.

Save the .vpp file in the root of your Eclipse project directory.

File | Save As...

Use the ... button to navigate to the root of your Eclipse project directory.

Click OK.

Create the class diagram

File | New Diagram | UML Diagrams | Class Diagram.

Click the Class tool: Class Class Generalization . Drag out a rectangle in the diagram panel. Set the new class' name to Company.

Add the following properties (attributes) and method (operation):Properties (right-click on the Company class in the diagram, then select Add| Attribute)

name:String
location:String

Public Method(right-click, then Add | Operation)

payEmployees

Use a gradient background style:

Right-click on the class, Styles and Formatting | Formats...

Click the background tab.

Select gradient.

Select Mint Blue.

Click OK.

Your class diagram should look something like this:

company class

Add an Employee class that has three properties:

lastName:String

firstName:String

jobTitle:String

Set the background style to be the same as that for Company, but with the Golden gradient.

Create an association that indicates that a Company has zero or more Employees.

Click on the Association tool:association tool .

Drag from the Company class to the Employee class.

Although the focus is probably now in a text entry for the name of the association, don't give it a name.

Instead, click elsewhere on the association line to select it.

Go to the Property view. Under Role A, scroll down to the Navigable property and set it to false. This should make the Company end of the association not-navigable, but the Employee end is still navigable (has an arrowhead).

Scroll down to Role B and set the name to employees.

Scroll further down in Role B to its Multiplicity property. Set this to *.

At this point, your diagram should look something like this:
Company_and_Employee.png

Create two more classes near the bottom of the diagram:

Grunt, with a public method called doWork.

Manager, with a public method called takeVacation.

Style them like Employee.

Have the Manager and Grunt inherit from Employee:

Click on the Generalization tool, Generalization_Tool.png, then drag from Employee to Grunt. In English we can say that a Grunt "is an" Employee.

Use the Generalization tool again to make Manager inherit from Employee.

At this point your diagram should look something like this:

Grunt_and_Manager_Added.png

Generate source code:

Tools | Instant Generator | Java...

Check {FLname}MyCompanyDesign, which should check all four of your classes under it.

Clear the attribute and parameter prefixes.

Uncheck "Generate Ant build file".

Set the Association Implementation to ArrayList.

Set the Output path to the src directory of your Eclipse project.

InstantGenerator.png

Click Generate, then Close.

In Eclipse, have a look at the new source code files:

In the Package Explorer, expand the project, the src dir, and its default package. Double-click on Company.java, and browse the code that has been generated. Notice, in particular, that an ArrayList<Employee> called employees has been added. This is the code that corresponds to the arrow (open arrow head) from Company to Employee. Its type is List because we set the multiplicity to * (meaning many). If the multiplicity had been left at 1, then the type would have been Employee, and we would have named the variable something like employee.

Double-click on Grunt.java. Notice that it "extends Employee". This is the code that corresponds to the arrow (closed arrow head) from Grunt to Employee.

Add getters and setters for the attributes of your classes:

Open Company.java in the editor, right-click inside of the class | Source | Generate getters and setters....

Check all of the variables.

Click OK.

Notice that getters and setters have been added to Company.

Add a constructor using the attributes:

In Company.java, right-click inside of the class | Source | Generate Constructor Using Fields....

Check all of the variables.

Click OK.

Notice that a constructor has been added that allows a caller to construct a Company and initialize its attributes.

Repeat the addition of getters, setters, and a constructor for Employee.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Please find the answer in the screenshots:-

Java EE ava Elipse Eile Edit Source Refactor Navigate Search Projec Bun Window Help Quick Access || ! Java EE 4 Java Debug CJava EE ava Eclipse Eile Edit Source Refactor Navigate Search Projec Bun Window Help Quick Access || ! Java EE 4 Java DebugJava EE Eile Edit Source Refactor Navigate Search Projec Bun Window Help Quick Access || ! Java EE 4 Java Debug ompanyJava 2Java EE Eile Edit Source Refactor Navigate Search Projec Bun Window Help Quick Access || ! Java EE 4Java Debug 2 publ1c clasJava EE Eile Edit Source Refactor Navigate Search Projec Bun Window Help er java - Eclipse Quick Access || E< | Java EE 4 Ja

Add a comment
Know the answer?
Add Answer to:
Open Visual Paradigm for UML. File | New Project. Set the Project name to {FLname}MyCompanyDesign, where...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Create a NetBeans project called "Question 1". Then create a public class inside question1 package called Author according to the following information (Make sure to check the UML diagram)

    Create a NetBeans project called "Question 1". Then create a public class inside question1 package called Author according to the following information (Make sure to check the UML diagram) Author -name:String -email:String -gender:char +Author(name:String, email:String, gender:char) +getName():String +getEmail):String +setEmail (email:String):void +getGender():char +tostring ):String . Three private instance variables: name (String), email (String), and gender (char of either 'm' or 'f'): One constructor to initialize the name, email and gender with the given values . Getters and setters: get Name (), getEmail() and getGender (). There are no setters for name and...

  • using CSCI300 java Given the following UML Class Diagram Club_Card # card_num : String # name...

    using CSCI300 java Given the following UML Class Diagram Club_Card # card_num : String # name : String # age: int # year: int + Club_Card (all parameters) + Setters & Getters + toString() : String + equals(x: Object): boolean [10 pts] Define the class Club_Card, which contains: 1. All arguments constructor which accepts all required arguments from the main and instantiate a Club_Card object. 2. Set & get method for each data attribute. 3. A toString() method which returns...

  • In this assignment, you will implement Address and Residence classes. Create a new java project. Part...

    In this assignment, you will implement Address and Residence classes. Create a new java project. Part A Implementation details of Address class: Add and implement a class named Address according to specifications in the UML class diagram. Data fields: street, city, province and zipCode. Constructors: A no-arg constructor that creates a default Address. A constructor that creates an address with the specified street, city, state, and zipCode Getters and setters for all the class fields. toString() to print out all...

  • signature 1. Create a new NetBeans Java project. The name of the project has to be...

    signature 1. Create a new NetBeans Java project. The name of the project has to be the first part of the name you write on the test sheet. The name of the package has to be testo You can chose a name for the Main class. (2p) 2. Create a new class named Address in the test Two package. This class has the following attributes: city: String-the name of the city zip: int - the ZIP code of the city...

  • The class Engineer Test below is used to test two other class named Project & Engineer....

    The class Engineer Test below is used to test two other class named Project & Engineer. A project has three attributes: projNo (int), projName (string), revenue (double). Add a parameterized constructor, and setters & getters for all attributes. An engineer has four attributes: jobld (int), name (string), rate (double), and a list of projects. For each project, the engineer has a specific amount as profit (project revenue rate). Add a constructor that initializes the attributes: jobild, name and rate. Implement...

  • I need help for part B and C 1) Create a new project in NetBeans called...

    I need help for part B and C 1) Create a new project in NetBeans called Lab6Inheritance. Add a new Java class to the project called Person. 2) The UML class diagram for Person is as follows: Person - name: String - id: int + Person( String name, int id) + getName(): String + getido: int + display(): void 3) Add fields to Person class. 4) Add the constructor and the getters to person class. 5) Add the display() method,...

  • C++ Lab 9A Inheritance Employee Class Create a project C2010Lab9a; add a source file Lab9a.cpp to...

    C++ Lab 9A Inheritance Employee Class Create a project C2010Lab9a; add a source file Lab9a.cpp to the project. Copy and paste the code is listed below: Design a class named Employee. The class should keep the following information in member variables: Employee name Employee number Hire date // Specification file for the Employee class #ifndef EMPLOYEE_H #define EMPLOYEE_H #include <string> using namespace std; class Employee { private:        // Declare the Employee name string variable here. // Declare the Employee...

  • Here is the UML for the class Contact -fullName : string -phoneNum: string -emailAddress : string...

    Here is the UML for the class Contact -fullName : string -phoneNum: string -emailAddress : string +Contact()                     //default constructor sets all attribute strings to “unknown”; no other constructor +setName(string name) : void +setPhone(string pn) : void +setEmail(string em) : void +getName() : string +getPhone() : string +getEmail() : string +printContact() : void         //print out the name, phone numbers and email address Create New Project Name your project: CIS247_Lab7_YourLastName. For this exercise, you may use a header file or one file...

  • 1) (10 points) Create a new Java project, name it "Quiz02". Create a java class Traveler...

    1) (10 points) Create a new Java project, name it "Quiz02". Create a java class Traveler that has four data members, String name, Date bDate, int id and int noOfDependens. Generate the following: 1- Getters and Setters. 2- Four parametrize constructor to initialize the four data members above. 3- toString() method. Create a java class Flight that has four data members, String number, String destination, int capacity, and ArrayList<Traveler> travelers. • Notel - travelers will be used to track the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT