Assignment 7: Adding/Removing Skillsets  This assignment will be…

Assignment 7: Adding/Removing Skillsets 

This assignment will be building on to the prior assignment and will utilize the same Eclipse

project. Please refer to assignment 3 if you need assistance downloading the project template

and understanding the existing architecture that you will contribute to.

In this assignment you will add the ability to add skill sets to your resume on LinkedIn. There

should be three new menu actions: one for adding a new skill set, one for removing a skillset,

and one to list all your skillsets in alphabetical order. 

Task 1 – Add a Skillset Property to the LinkedInUser 

Package: edu.institution.actions.asn2

Class: LinkedInUser

A requirement for this assignment is to not allow duplicate skillsets to be added for a user. A

Set is the perfect collection for this since Sets ignore duplicate entries. Add an additional Set

property to your LinkedInUser class called skillsets.  

private Set<String> skillsets; 

And add the following methods which interact with the skillsets property.

/** Returns the skillsets. */

public Set<String> getSkillsets()

/** Adds the supplied skillset to this user. */

public void addSkillset(String skillset)

/** Removes the supplied skillset from this user. */

public void removeSkillset(String skillset) 

Your List Skillset action (task 4 below) requires that the skillsets be displayed in alphabetical

order. You are required to use the appropriate Set implementation that accomplishes easily

accomplishes this.

Task 2 – Add Global Skillset Counter 

Package: edu.institution.

Class: ApplicationHelper

We want to keep track (globally) each skillset and the number of users that share that same

skillset. Static methods and static properties are the perfect choice for this requirement 

Copyright © 2020. Doug Estep – All rights reserved. Copyright registration number: TXU002159309.  

because static methods and properties are not associated with a single instance. Instead, they

are shared amongst every instance in the JVM. The architecture already defines a static helper

class called, edu.institution.ApplicationHelper.  

Let’s add to this existing class.  

1) Pick a Collection that allows you to retrieve the number of users that share a skillset. 

The key is the skillset and the value is the number of users that share that skillset. 

Define this collection as a private static property in the ApplicationHelper class. Place an

EXPLANATION comment above the property explaining why you chose the collection.

2) Add the below method to the ApplicationHelper class in order to increment the count

associated with the skillset.

/** 

 * Increments the number of users associated with the supplied skillset.

 * If this is the first occurrence of the supplied skillset, then add 

 * the skillset to your collection and default the count to one.  

 *

 * @param skillset the skillset to increment.

 */

public static void incrementSkillsetCount(String skillset); 

3) Add the below method to the ApplicationHelper class in order to decrement the count

associated with the skillset.

/**

 * Decrements the number of users associated with the supplied skillset.

 * If the number of users associated with the supplied skillset is zero, 

 * then remove the skillset from your collection.  

 *

 * @param skillset the skillset to decrement.

 */

public static void decrementSkillsetCount(String skillset); 

4) Add the below method to the ApplicationHelper class in order to retrieve the number of

users that share the supplied skillset.

/**

 * Retrieves the number of users associated with the supplied skillset. 

 * If the skillset is not in the collection, return -1. 

 *

 * @param skillset the skillset to lookup.

 */

public static int retrieveSkillsetCount(String skillset); 

5) When the application starts up, the skillset usage counts will need to be initiated from

the loaded users. Add the below method to the ApplicationHelper class. This method 

Copyright © 2020. Doug Estep – All rights reserved. Copyright registration number: TXU002159309.  

accepts the list of LinkedInUser’s loaded from the file system. For each user, loop

through their skillset’s and call the incrementSkillsetCount method – passing the skillset. 

/**

 * Loops through each user and increments the global skillset usage count for

 * each skillset associated with the user.

 * 

 * @param users the list of users.

 */

public static void initSkillsetUsages(List<LinkedInUser> users); 

Task 3 – Modify the SerializedUserRepository 

Package: edu.institution.actions.asn3

Class: SerializedUserRepository 

Modify the init method to call the ApplicationHelper.initSkillsetUsages method, passing the

LinkedInUser’s read from the file system. This will initiate the skillset usage counts after the

application starts up.

Task 4 – List Skillset Action 

Package: edu.institution.actions.asn7

Class: ListSkillsetAction

public class ListSkillsetAction implements MenuAction {

 // implement the process method

This action is required to print each skillset associated with the logged in user in alphabetical

order. For each skillset associated with the logged in user, display the skillset, followed by the

number of users that share that same skillset. Here is a sample output:

Here are your skillsets

Cooking (X users)

Java (X users)

Skiing (X users)

The above example assumes the logged in user has 3 skillsets; Cooking, Java, and Skiiing. 

The X represents the number of users that shares that same skillset. Substitute the actual

number for the X in the actual display. To get the actual number of users associated with each 

Copyright © 2020. Doug Estep – All rights reserved. Copyright registration number: TXU002159309.  

skillset, your action will need to call the ApplicationHelper.retrieveSkillsetCount(String) method

that you wrote in task 1.

If the logged in user has no skillsets display the message, “You have not entered any skillsets.”

The process method for the action should return true to keep the user signed in.

Task 5 – Add Skillset Action 

Package: edu.institution.actions.asn7

Class: AddSkillsetAction

(Use the supplied Scanner instance to prompt the user for information. Do not create your

own instance of Scanner in any action) 

Prompt the user for the skillset to add. A skillset can be any String. Examples of skillsets are:

“java” “software design”, “databases”, etc.  

Add the skillset to the logged in user’s skillsets and then provide a response to the logged in

user indicating that their skillset has been added (e.g. “Java has been added to your skillsets.”). 

You don’t have to display any additional messages if the user added a duplicate skillset. In this

assignment the case of the skillset doesn’t apply – meaning “JAVA” and “java” should be

treated as two different skillsets.

In order to track the skillset globally, call the ApplicationHelper.incrementSkillsetCount(String)

method that you wrote in Task 2, passing the added skillset. 

public class AddSkillsetAction implements MenuAction {

 // implement the process method

The process method for the action should return true to keep the user signed in. 

Task 6 – Remove Skillset Action 

Package: edu.institution.actions.asn7

Class: RemoveSkillsetAction

(Use the supplied Scanner instance to prompt the user for information. Do not create your

own instance of Scanner in any action)

Prompt the user for the skillset to remove and remove the entered skillset from the logged in

user’s skillsets. If the entered skillset is not in the logged in user’s skillsets, then return true to 

Copyright © 2020. Doug Estep – All rights reserved. Copyright registration number: TXU002159309.  

keep the user signed in and do NOT call the ApplicationHelper.decrementSkillsetCount(String)

method for the entered skillset.

If the entered skillset was removed from the logged in user’s skillsets, then call the

ApplicationHelper.decrementSkillsetCount(String) method, passing the removed skillset.

public class RemoveSkillsetAction implements MenuAction {

 // implement the process method

The process method for the action should return true to keep the user signed in. 

How You Are Graded 

1. The retrieveSkillsetCount, incrementSkillsetCount, decrementSkillsetCount, and

initSkillsetUsages methods were added to the ApplicationHelper class as specified in this

assignment and behave as specified and an EXPLANATION comment was provided

explaining your Collection choice. (3.5 points)

2. You included an EXPLANATION comment in the ApplicationHelper class defending your

choice of the Collection. (0.5 points)

3. A Set property was added (with the discussed methods) on the LinkedInUser. (1 point)

4. The List Skillsets option behaves as specified in this assignment (1 points)

5. The Add Skillset option behaves as specified in this assignment (2 points)

6. The Remove Skillset option behaves as specified in this assignment (2 points) 

Notes 

1. You are not required to write JUnit tests for this assignment.

2. Your project is sent to a service which tests and attempts to grade your assignment.

That automated grading process is much easier if you follow the instructions with

regards to class names, method names, and output messages. I do evaluate your project

after the automated grading occurs to help you understand any mistakes that was

pointed out and possibly adjust any points that was deducted from your project.

3. Your project is sent to a service that checks for plagiarism. If the service flags your

project for plagiarism, I evaluate it against the student it matched to. If I determine that

your project was plagiarized, you will receive a score of zero on the assignment.

Continued offenses could result in disciplinary actions taken by this institution.

4. If your program does not compile, you will receive a score of zero on the assignment

5. If your program compiles but does not run, you will receive a score of zero on the

assignment.

6. If your Eclipse project is not exported and uploaded to the drop box correctly, you will

receive a score of zero on the assignment. 

Copyright © 2020. Doug Estep – All rights reserved. Copyright registration number: TXU002159309.  

7. If you do not submit code that solves the problem for this assignment, you will not

receive any points for the program’s compiling or the program’s running. 

Copyright © 2020. Doug Estep – All rights reserved. Copyright registration number: TXU002159309.