Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Help with a java project: Must have at least 6 classes. Description For this project, you will put together several techniques and concepts you have

Help with a java project:

Must have at least 6 classes.

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Description For this project, you will put together several techniques and concepts you have learned in CS 210 (or from a similar background) and some new techniques to make Health, an application that reads, stores, and output data on a json file. Health will read through a simplified JSON file, store the data from each json entry in a structured way (e.g., the list of json fields will be stored as an array of object with one array element per ID), and provide output derived from the input (e.g., besides listing the author of the json entry, Health will indicate the number of observations on that json data). Operational Issues: Your program will read the json data file (a json file) via redirected standard input (use health.json). Each user comment entry is organized as follows: Each entry will begin with a sign (), a designation of the type of entry (such as "author"), a colon (:), the name of the author " ", and then comma at the end. The entry will then contain zero or more lines, each with the same basic form: zero or more spaces and/or tabs, a field designator (such as "body"), a colon (:), arbitrary text, and possibly a comma. If the comma is present, it means there may be another field left in the entry. If the comma is not present, there are no more fields remaining in the entry After all of the fields for the entry, there will be a line containing closing curly brace to match the one from the start. The file will then contain zero or more empty lines before the start of the next entry For example: author": "LittleLarry", "author flair css class": nul1, "author flair text": null, "body": "I was under the impression people got their tonsils out due to strep throat infections. "created utc: 1483228929, "id": "dbumgju" "link id": "t3_51by9q" "parentid": "t351by9q", "score":12 "stickied": false, "subreddit": "Health", "subreddit_id": t52qh9z" The line indicates that the entry author is "LittleLarry" is its value. And so on. This entry happens to contain another 11 fields, before the closing curly brace for the entry For a few fields, more processing is needed for the values. For the created utc, the value should be stored as a long or an integer. For the other fields, the value should be suitable formats. Note that not every entry will have the same fields. You may assume that there are no more 20 fields per entry (not including the subfields for the fields) and no more than 5,000 comment entries in the input file. After reading in and storing all entries in the file, Health will print out all of the data in the same format as it was read in with one additional field per entry (Write to output to the result.txt file). This field will include some summary data about the entry derived from the other fields (if present) and will be designated "counts." It will give the number of fields in the last original entry (by not counting null values), the highest score for user and the most recent highest score date, the most frequent word or words for the author, and the length of the longest field. It is important to note that there will be more than one comment per author. Therefore, you need to consider all comments for an user according the author field, then find the highest score, highest score date, the most frequent word or words for the author (ignore case sensitivity: "al" is same as "All", but "your" is different from "yours"). The other fields should be from the last comment (created utc represents date in json file.). If the highest score is same, then the newest comment score will be used. For example: the author fizaali12 has two comments in the health.json file and they are: "author": "fizaali12", "author flair css class": null "author flair text": null, "body": "Very Helpful Video About Stomach Diseases Must Watch", "created ute": 1484033718, "id": "dc8g7tt" "link id": "t3 5n3gg9" "parent_id": "t3_5n3qg9", "score":1, "stickied": false, "subreddit": "Health", "subreddit id": "t5 2gh9z" "author": "fizaali12", "author flair css class": null, "author flair text": null, "body": "5 foods you should never eat on an empty stomach", "created ute": 1484601504, "id": "dcih4d0", "link id": "t3 5odix4" "parent id": "t3 5odix4" "score":1, "stickied": false, "subreddit": "Health", "subreddit id": "t5 2gh9z" Therefore, the output for fizaali12 in the results.txt file should be: "author": "fizaali12", "author flair css class": null, "author flair text": null, "body": "5 foods you should never eat on an empty stomach", "created ute": 1/16/2017, 4:18:24 PM, "id": "dcih4d0", "link id": "t3 5odix4" "parent id": "t3 5odix4" "score":1, "stickied": false, "subreddit": "Health", "subreddit_id": "t5_2qh9z", "count""the number of non null fields":10, "the longest field": "the highest_score" 1 "the highest score_date": 1/1672017, 4:18:24 PM, "the most frequent words in all comments": ["stomach": 2] "body"the longest field value length":48, This is the same example as before, with the addition of the final fields indicating the specified field counts and some additional informaion like highest score, etc. You need to change all date format from json format the same as above or similar to above format. Implementation Issues: For each class you implement, you must implement appropriate (and appropriately named) constructor, display, and size methods. It is possible that the value is null. In that case, the fields should not be counted for the number of fields. If there is no grade or missing component you should handle them appropriately. Nates In this project, the only library you will use is scanner with File. You cannot use any Java Collection Library (Array operation library) but can use String Library. You can also use Date library in java for conversion Be sure to use good object-oriented design in this project. That includes appropriate use of encapsulation, inheritance, overloading, overriding, accessibility modifiers, etc. Be sure to use good code documentation. This includes header comments for all classes and methods, ts for each section of code, meaningful variable and method names, consistent indentation, etc. You may write your program from scratch or may start from programs for which the source code is freely available on the web or through other sources (such as friends or student organizations). If you do not start from scratch, you must give a complete and accurate accounting of where all of your code came from and indicate which parts are original or changed, and which you got from which other sources. Failure to give credit where credit is due is academic fraud and will be dealt with accordingly. Description For this project, you will put together several techniques and concepts you have learned in CS 210 (or from a similar background) and some new techniques to make Health, an application that reads, stores, and output data on a json file. Health will read through a simplified JSON file, store the data from each json entry in a structured way (e.g., the list of json fields will be stored as an array of object with one array element per ID), and provide output derived from the input (e.g., besides listing the author of the json entry, Health will indicate the number of observations on that json data). Operational Issues: Your program will read the json data file (a json file) via redirected standard input (use health.json). Each user comment entry is organized as follows: Each entry will begin with a sign (), a designation of the type of entry (such as "author"), a colon (:), the name of the author " ", and then comma at the end. The entry will then contain zero or more lines, each with the same basic form: zero or more spaces and/or tabs, a field designator (such as "body"), a colon (:), arbitrary text, and possibly a comma. If the comma is present, it means there may be another field left in the entry. If the comma is not present, there are no more fields remaining in the entry After all of the fields for the entry, there will be a line containing closing curly brace to match the one from the start. The file will then contain zero or more empty lines before the start of the next entry For example: author": "LittleLarry", "author flair css class": nul1, "author flair text": null, "body": "I was under the impression people got their tonsils out due to strep throat infections. "created utc: 1483228929, "id": "dbumgju" "link id": "t3_51by9q" "parentid": "t351by9q", "score":12 "stickied": false, "subreddit": "Health", "subreddit_id": t52qh9z" The line indicates that the entry author is "LittleLarry" is its value. And so on. This entry happens to contain another 11 fields, before the closing curly brace for the entry For a few fields, more processing is needed for the values. For the created utc, the value should be stored as a long or an integer. For the other fields, the value should be suitable formats. Note that not every entry will have the same fields. You may assume that there are no more 20 fields per entry (not including the subfields for the fields) and no more than 5,000 comment entries in the input file. After reading in and storing all entries in the file, Health will print out all of the data in the same format as it was read in with one additional field per entry (Write to output to the result.txt file). This field will include some summary data about the entry derived from the other fields (if present) and will be designated "counts." It will give the number of fields in the last original entry (by not counting null values), the highest score for user and the most recent highest score date, the most frequent word or words for the author, and the length of the longest field. It is important to note that there will be more than one comment per author. Therefore, you need to consider all comments for an user according the author field, then find the highest score, highest score date, the most frequent word or words for the author (ignore case sensitivity: "al" is same as "All", but "your" is different from "yours"). The other fields should be from the last comment (created utc represents date in json file.). If the highest score is same, then the newest comment score will be used. For example: the author fizaali12 has two comments in the health.json file and they are: "author": "fizaali12", "author flair css class": null "author flair text": null, "body": "Very Helpful Video About Stomach Diseases Must Watch", "created ute": 1484033718, "id": "dc8g7tt" "link id": "t3 5n3gg9" "parent_id": "t3_5n3qg9", "score":1, "stickied": false, "subreddit": "Health", "subreddit id": "t5 2gh9z" "author": "fizaali12", "author flair css class": null, "author flair text": null, "body": "5 foods you should never eat on an empty stomach", "created ute": 1484601504, "id": "dcih4d0", "link id": "t3 5odix4" "parent id": "t3 5odix4" "score":1, "stickied": false, "subreddit": "Health", "subreddit id": "t5 2gh9z" Therefore, the output for fizaali12 in the results.txt file should be: "author": "fizaali12", "author flair css class": null, "author flair text": null, "body": "5 foods you should never eat on an empty stomach", "created ute": 1/16/2017, 4:18:24 PM, "id": "dcih4d0", "link id": "t3 5odix4" "parent id": "t3 5odix4" "score":1, "stickied": false, "subreddit": "Health", "subreddit_id": "t5_2qh9z", "count""the number of non null fields":10, "the longest field": "the highest_score" 1 "the highest score_date": 1/1672017, 4:18:24 PM, "the most frequent words in all comments": ["stomach": 2] "body"the longest field value length":48, This is the same example as before, with the addition of the final fields indicating the specified field counts and some additional informaion like highest score, etc. You need to change all date format from json format the same as above or similar to above format. Implementation Issues: For each class you implement, you must implement appropriate (and appropriately named) constructor, display, and size methods. It is possible that the value is null. In that case, the fields should not be counted for the number of fields. If there is no grade or missing component you should handle them appropriately. Nates In this project, the only library you will use is scanner with File. You cannot use any Java Collection Library (Array operation library) but can use String Library. You can also use Date library in java for conversion Be sure to use good object-oriented design in this project. That includes appropriate use of encapsulation, inheritance, overloading, overriding, accessibility modifiers, etc. Be sure to use good code documentation. This includes header comments for all classes and methods, ts for each section of code, meaningful variable and method names, consistent indentation, etc. You may write your program from scratch or may start from programs for which the source code is freely available on the web or through other sources (such as friends or student organizations). If you do not start from scratch, you must give a complete and accurate accounting of where all of your code came from and indicate which parts are original or changed, and which you got from which other sources. Failure to give credit where credit is due is academic fraud and will be dealt with accordingly

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

Business Process Driven Database Design With Oracle PL SQL

Authors: Rajeev Kaula

1st Edition

1795532386, 978-1795532389

More Books

Students also viewed these Databases questions

Question

Explain why product extension and refinement are important.

Answered: 1 week ago