Java “app” program improvement

24/7 Homework Help

Stuck on a homework question? Our verified tutors can answer all questions, from basic math to advanced rocket science!

Part I:
Split your
app source code into separate files. Each class or interface should have its own file, except very small classes like Exceptions, which could be in the file for the class that uses them.
Add all classes and interfaces except your main class to a package. You’ll need to import them into your main class.


Part II:
Create a content.txt file for user-generated content data on your social network (posts or  tweets or stories, etc.) and load them into a global list, similar to how the users are loaded. 
Each piece of content should have an associated User that authored it.

Update your Social Network program so it can handle missing or bad data in the input files.

You’ll need to catch exceptions that could be thrown if e.g. a file is missing or a data format is bad.

You’ll probably also need to throw exceptions if e.g. a piece of data is missing or wrong.

Situations you might want to consider include:

1. Users file (people.txt) is missing

2. Relationships file (relationships.txt) is missing

3. There are not enough pieces of data for a user.

4. There are not enough pieces of data for a relationship.

5. A piece of data is the wrong format (e.g. a birthday is “potato” or a number is “potato”.)

6. A name in the relationships.txt file is of a person who doesn’t exist.

For this assignment, you’ll be building two feeds of user-generated content.

The logged in user

For both feeds, you’ll need to select a user for whom the feeds will be. We can call this the “logged in user”, in the sense that this is the user that’s logged into our app and we’re presenting the feeds to.

The logged in user can be any user in your system; you can choose the first user in your list, or the last, or a random, or anything else you’d like. Please keep in mind I’ll change the list of users and posts as I test your app, so don’t hard-code a user’s name or something similar. 

The main feed

The main user feed is simply a feed of the content posted by all users that the logged in user follows/is friends with. 

The content should be in order of posting: e.g. if the following content exists, in this order:

Post 1 by user A

Post 2 by user A

Post 3 by user B

Post 4 by user C

Post 5 by user A

Post 6 by user D

and our logged in user follows user A and user C, they should see the posts in this order in their main feed:

Post 1 by user A

Post 2 by user A

Post 4 by user C

Post 5 by user A

The recommended feed

The recommended content feed is made up of the content posted by the logged in user’s “recommended users”. The recommended users are the users that are followed/friends of the users that the logged in user is following/is friends with. 

(Users that the logged-in user follows are not recommended users, even if another user they follow follows them as well.)

In other words, if the logged in user follows users A and C, and user A follows B and C, and C follows D and F, the logged in user’s “recommended users” are B, D and F. 

The assignment

Display the logged-in user, the first 10 pieces of content from main feed, and the first 10 pieces of content from their recommended feed. 

You can stop displaying all users and all content.

Task: Update your Social Network program so that it loads a list of users, and a list of their relationships, from two files:

people.txt contains a list of the users with all the data needed to create each user: name, date of birth, age, or whatever other information about your user your program stores. Each person is on a separate line. The different fields are separated by a symbol (I recommend the vertical line “|”, it’s on the same key as “\”).

relationships.txt contains a list of relationships (friendships, follows, family relationships, or whatever else your social network tracks). Each relationship lists the names of both people in the relationship on each line. The different fields are separated by a symbol (I recommend the vertical line “|”, it’s on the same key as “\”).

Example files are attached.

Notes:

1. The data in the files is always text data. If the data you need for your Users is something other than String, e.g. a number or Date, you have to handle the converting of that data from String to the correct format.

2. Files.readLines() and string.split() are your friends.
3. string.split(“|”) will treat “|” as a special character and won’t work as you expect. To do what you want, you have to use \ to tell it not to treat it as a special character: string.split(“\|”)

Hire a competent writer to help you with

Java “app” program improvement

troublesome homework