Docsity

JAVA programming language to complete a program that process the short message that is bro, Assignments of Java Programming

Toggle sidebar
bg1
In this assignment, you are going to use JAVA programming language to complete a
program that process the short message that is broadcasted in Southeast area. The
program will categorize and display the message that is broadcasted in defined format.
The report tag (#tag); text content (#tct); a location (#loc) such as a street address; and
latitude (#lat)and longitude (#lng). For example:
"#tag smoke; #tct its raining ash from mountain fire here; #loc blueridge, ga; #lat
35.764709; #lng -82.265285;"
Your program should implement following functions:
1- You can always assume that the message broadcasted is in the format of you can
assume that all of the tweets to process have the following format:
#tag value; #tct value; #loc value; #lat value; #lng value;
2- The program should ask user to input broadcasted message.
3- The program will be splitting up (parsing) the message into the five different types of
information specified by the defined tags
4- After extracting the value encoded by each tag, the program should categorize
message based on tag value as follows:
* If the value of tag value is one of "fire" or "smoke", then category should be assigned
the value
ALERT.
* Otherwise, if the value of tag value is "need", then category should be assigned the
value NEED.
* Otherwise, if the value of tag value is "offer", then category should be assigned the
value OFFER.
* Otherwise, if the value of tag value is one of "structure", "road", "photo", or "evac",
then category should be assigned the value INFO.
* Otherwise, category should be assigned the value UNKNOWN. The broadcasted
message tagged value is not necessary all lower case, it might mixed with upper and
lower.
* Additionally, the program should be able to decide whether the message is in
boundaries or not based on the defined geographic boundaries that the program uses.
Some messages will originate from within those bounds, other messages will not. The
program defines metro-Atlanta as below:
* south double 33.5638 // southernmost latitude
* north double 33.9334 // northernmost latitude
* west double -84.6094 // westernmost longitude
* east double -84.1287 // easternmost longitude
1- If the message is within the boundary of defined boundaries, print In Boundaries: true
2- Make sure the outputs line up on the right-hand side. Each column in the output lines
up vertically.
3- The program prompt the user to enter the formatted message as: Please enter a
formatted message.
4- Create a class called MessageProcessor. All statements should be defined in the
main method of the class.
pf3
pf4

Partial preview of the text

Download JAVA programming language to complete a program that process the short message that is bro and more Assignments Java Programming in PDF only on Docsity!

In this assignment, you are going to use JAVA programming language to complete a

program that process the short message that is broadcasted in Southeast area. The

program will categorize and display the message that is broadcasted in defined format.

The report tag (#tag); text content (#tct); a location (#loc) such as a street address; and

latitude (#lat)and longitude (#lng). For example:

"#tag smoke; #tct its raining ash from mountain fire here; #loc blueridge, ga; #lat

35.764709; #lng -82.265285;"

Your program should implement following functions:

1- You can always assume that the message broadcasted is in the format of you can

assume that all of the tweets to process have the following format:

#tag value; #tct value; #loc value; #lat value; #lng value;

2- The program should ask user to input broadcasted message.

3- The program will be splitting up (parsing) the message into the five different types of

information specified by the defined tags

4- After extracting the value encoded by each tag, the program should categorize

message based on tag value as follows:

* If the value of tag value is one of "fire" or "smoke", then category should be assigned

the value

ALERT.

* Otherwise, if the value of tag value is "need", then category should be assigned the

value NEED.

* Otherwise, if the value of tag value is "offer", then category should be assigned the

value OFFER.

* Otherwise, if the value of tag value is one of "structure", "road", "photo", or "evac",

then category should be assigned the value INFO.

* Otherwise, category should be assigned the value UNKNOWN. The broadcasted

message tagged value is not necessary all lower case, it might mixed with upper and

lower.

* Additionally, the program should be able to decide whether the message is in

boundaries or not based on the defined geographic boundaries that the program uses.

Some messages will originate from within those bounds, other messages will not. The

program defines metro-Atlanta as below:

* south double 33.5638 // southernmost latitude

* north double 33.9334 // northernmost latitude

* west double -84.6094 // westernmost longitude

* east double -84.1287 // easternmost longitude

1- If the message is within the boundary of defined boundaries, print In Boundaries: true

2- Make sure the outputs line up on the right-hand side. Each column in the output lines

up vertically.

3- The program prompt the user to enter the formatted message as: Please enter a

formatted message.

4- Create a class called MessageProcessor. All statements should be defined in the

main method of the class.

5- Once your program is implemented, compile and run your program. A sample

executions is shown below, and your program should print processed message in same

format!!!

6- You should run your program with various inputs, and test that your program is

producing correct outputs. You are also responsible for ensuring that your program

doesn’t contain any syntax, runtime, or logical errors. Always TEST, TEST and RETEST

the programs you create.

Here are some sample formatted messages:

1. "#tag photo; #tct swan on lake near spivey hall; #loc spivey hall, clayton; #lat

33.593131; #lng -84.329225;"

2. "#tag smoke; #tct its raining ash from mountain fire here; #loc blueridge, ga; #lat

35.764709; #lng -82.265285;"

3. "#tag structure; #tct I85 damaged; #loc 224 left piedmont road (shed) (house okay);

#lat 33.8782343; #lng -84.3294661;"

// Checking if the message is within defined boundaries boolean inBoundaries = false; if (longitude >= - 84.6094 && longitude <= - 84.1287 && latitude >= 33. && latitude <= 33.9334) { inBoundaries = true; } // Displaying the processed message in the defined format System.out.printf("%-10s%-15s\n", "Category:", category); System.out.printf("%-10s%-15s\n", "Message:", textContent); System.out.printf("%-10s%-15s\n", "Location:", location); System.out.printf("%-10s%.6f\n", "Latitude:", latitude); System.out.printf("%-10s%.6f\n", "Longitude:", longitude); System.out.printf("%-10s%-15s\n", "In Boundaries:", inBoundaries); } }