Question
I need the code for this assignment!!! (this is is my second time posting this, PLEASE DO NOT ANSWER TWICE as I want a varation
I need the code for this assignment!!!
(this is is my second time posting this, PLEASE DO NOT ANSWER TWICE as I want a varation of answers and methods)
assignment 3: Getting Started with Web Requests and Bots
This assignment is broken down into the following pieces:
PART 1 - Making Use of a REST API and Web Requests
Make Web Requests to Receive Data (REST), you will need to learn more on what this is.
You can use Postman (app) to test requests
Get trending tags
https://dev.twitter.com/rest/reference/get/trends/place
Weather
Get Local Temperature
https://openweathermap.org/api
For example: You can hit a URL like : api.openweathermap.org/data/2.5/forecast?lat=35&lon=139
(example pic 1) http://imgur.com/a/uc2eS
The response format that you get is called JSON (Javascript Object Notation). You will want to read up more on this (http://codular.com/json).
A good JSON editor is: http://www.jsoneditoronline.org/ It can easily parse it and let you understand the JSON.
Your Java Program will need to parse the JSON to make use of the data. You will definitely need to use a library to parse the Json. GSON is a good library to use, look it up on your own. Use this website for reference:
http://www.oracle.com/technetwork/articles/java/json-1973242.html
Ideally, you will want to make a method that you can call in your Java program that return this information to you. For example a function like: int getWeather(string city) -> returns the current temperature from the Weather API
PART 2 - Creating a Interfaceable Chat Bot
You will want to first create a simple program that can connect to the Chat Server. The chatserver we will be using is called FreeNode. Here is some sample code to s
Use Java.Net Library to create a Chat Server
Directions are provided below
You will expose your bot so anyone can interact with it
Check next page for code sample
When the bots connected to the group chat it should read the messages and when a message matches a command it respond accordingly. This means if someone says Weather 75080 it should return parse the words and query the weather API and return the information in a IRC-friendly format (The weathers going to be X with a high of Y and a low of Z.
Use command phrases that trigger a response
Weather 75080
Hows the weather in 75080?
Use your wrapper and respond accordingly.
It doesnt have to use Natural Language Processing, keywords is fine
Here is some code to get you started with connecting to a bot on Freenode: http://archive.oreilly.com/pub/h/1966
(example pic 2) http://imgur.com/a/KbWPu
I am trying to get student visitors next week or someone from Makerspace Workshops to review the following with you:
1.)Web Requests in Java Making REST calls using Java. It will introduce you to how the web works and you will be able to make functions that can fetch data
2.)Building an IRC client Making an IRC client using Java. This should introduce you to Sockets and be able to connect and interact with an IRC server. Youll be able to make a functional Hello World bot.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started