Weather App Mini Project Report: VARDHMAN (19EUCS165) SHAILESH (19EUCS129) VIGNESH B (19EUCS168)
Weather App Mini Project Report: VARDHMAN (19EUCS165) SHAILESH (19EUCS129) VIGNESH B (19EUCS168)
WEATHER APP
submitted by
VARDHMAN (19EUCS165)
SHAILESH (19EUCS129)
VIGNESH B(19EUCS168)
of
BACHELOR OF ENGINEERING
In
BONAFIDE CERTIFICATE
Certified that this mini project report “WEATHER APP” is the bonafide work of “Vardhman
(19EUCS165), Shailesh (19EUCS129), Vignesh B(19EUCS168)” who carried out the project
work under my supervision.
SIGNATURE SIGNATURE
This project report is submitted for the autonomous project viva-voice examination held on
.....................
ACKNOWLEDGEMENT
We express our sincere thanks to the management and Dr. J. JANET M.E., Ph.D., Principal, Sri Krishna College
of Engineering and Technology, Coimbatore for providing us the facilities to carry out this mini project work.
We are thankful to Dr. P. KAVITHA RANI M.E.,Ph.D., Professor and Head, Department of Computer Science
and Engineering, for her continuous evaluation and commentsgiven during the course of the mini project work.
We express our deep sense of gratitude to our supervisor and mini project coordinator Mr. KARTHIKEYAN N,
Assistant Professor, Department of Computer science and Engineering for her valuable advice, guidance and
support during the course of our mini project work.
We express our heartfelt sense of gratitude and thanks to our beloved parents, family and friends who have helped
during the miniproject course.
4
ABSTRACT
Weather Application System is application of science and technology to detect the state of atmosphere for a
given location. Ancient weather detecting methods usually relied on observed patterns of events, also termed
pattern recognition. For example, it might be observed that if the sunset was particularly red, the following day
often brought fair weather. Here this system will detect weather and base it on parameters such as temperature,
humidity and wind. User will enter a certain place or city and the app will detect its humidity and wind and other
parameters. This App detects weather of a certain place using an open source database called Open Weather Map.
Then the application detects the weather conditions along with other parameters of certain place the user desires
and fetches it. This application developed as both web application and a mobile application.
1 INTRODUCTION
1.1 OVERVIEW 8
2 PROBLEM DEFINITION 10 2.1 PROBLEM STATEMENT 10
3.3.1 PERFORMANCE 12
4.3.1 PRE-CONDITION 14
4.3.2 POST-CONDITION 14
5 DESIGN
5.1 SCREENSHOTS 15
6 IMPLEMENTATION 26 6.1 FRONT END 26
6.1.1 FEATURES 26
6.2.1 MONGODB 43
7
6.2.2 FEATURES 45
6.3 CONNECTIVITY 45
6.3.1 MONGODB 45
6.3.3 FEATURES 45
6.4 CODE 46
CHAPTER-1
INTRODUCTION
Weather App is the application of science and technology to predict the conditions of
the atmosphere for a given location and time. You can get the realtime Weather
forecasting by using this web application. It detects the weather conditions and its
parameters of a certain place or city. User can view parameters and other info about
the place. This Application uses Java as a front-end and Open Weather Map database
as the back-end.
Weather finder is the application of science and technology topredict the conditions
of the atmosphere for a given city.People have attempted to predict the
weather informally for millennia and formally since the 19th century.
Weatherforecasts are made by collecting quantitative data about thecurrent state of the
atmosphere, land, and ocean
CHAPTER-2
PROBLEM DEFINITION
⮚
2.4 PROPOSED SYSTEM
CHAPTER-3
REQUIREMENTS
3.1 TOOL REQUIREMENTS
3.3.1 Performance
Performance is measured in terms of the output provided by the application. Requirement specification plays an
important part in the analysis of a system. Only when the requirement specifications are properly given, it is
possible to design an application, which will fit into required environment. The load for the user interface screens
shall take no longer than 2 seconds. . Queries shall return results within 5 seconds.
13
⮚ User Identification:
⮚ Login ID:
⮚ Modification:
o Any modification (insert, delete (or) update) for the Database shall be
synchronized and done only by the admin in the ward.
⮚ Admin Rights:
CHAPTER-4
MODULES DESCRIPTION
In this module we deal with login interface and retrieval of data from database in the server. The
client login with the given login id and password.The client can view the staff allocated and the class
timings . The handling of the data and records for such a vast system very complex task is done manually
but it can be made much easier if the system is computerized.
4.2 ADMIN FEATURES
⮚ With the Aquarium website, the admin can manage the reservation, timing of the ticket booking and
product buying and let user know thedetails.
4.3 USER FEATURES
⮚ user have their respective login including the attribute such as user name, phonenumber, email-id,
password for secured login.
⮚ user can view the ticket timing and products.
⮚ user can be able to view the newly available products.
4.3.1 PRE-CONDITION
⮚ The system displays the menu of available function that are detailed information.
⮚ This system displays the menu of admin panel.
4.3.2 POST-CONDITION
⮚ Login is successful.
⮚ Whole system make more flexible for user to use.
15
CHAPTER-5
SCREENSHOTS
5.1 USER INTERFACE
18
CHAPTER-6
IMPLEMENTATION
6.1 FRONT END
The JSON syntax is derived from JavaScript object notation syntax, but the JSON format is text only. JSON data
can easily be sent between computers, and used by any programming language. The Code for reading and
generating JSON data can be written in any programming language. JSON data is written as name/value pairs, just
like JavaScript object properties. JSON objects are written inside curly braces. JSON arrays are written inside
square brackets. A common use of JSON is to read data from a web server, and display the data in a web page.
6.1.2 UI CODE
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.WeatherUpdate" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
<style name="Theme.WeatherUpdate.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="Theme.WeatherUpdate.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="Theme.WeatherUpdate.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
</resources>
6.1.4 GRADIENT
package com.example.weatherupdate;
import android.graphics.Color;
import android.os.Bundle;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import androidx.appcompat.app.AppCompatActivity;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.text.DecimalFormat;
public class MainActivity extends AppCompatActivity {
EditText etCity, etCountry;
TextView tvResult;
private final String url = "https://api.openweathermap.org/data/2.5/weather";
private final String appid = "a97c0d9a7517628b6148ef4ece616784";
DecimalFormat df = new DecimalFormat("#.##");
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
etCity = findViewById(R.id.etCity);
etCountry = findViewById(R.id.etCountry);
tvResult = findViewById(R.id.tvResult);
}
public void getWeatherDetails(View view) {
String tempUrl = "";
String city = etCity.getText().toString().trim();
String country = etCountry.getText().toString().trim();
if(city.equals("")){
tvResult.setText("City field can not be empty!");
}else{
if(!country.equals("")){
tempUrl = url + "?q=" + city + "," + country + "&appid=" + appid;
}else{
tempUrl = url + "?q=" + city + "&appid=" + appid;
}
StringRequest stringRequest = new StringRequest(Request.Method.POST, tempUrl, new
Response.Listener<String>() {
@Override
public void onResponse(String response){
//Log.d("response",response);
String output = "";
try {
JSONObject jsonResponse = new JSONObject(response);
JSONArray jsonArray = jsonResponse.getJSONArray("weather");
JSONObject jsonObjectWeather = jsonArray.getJSONObject(0);
String description = jsonObjectWeather.getString("description");
JSONObject jsonObjectMain = jsonResponse.getJSONObject("main");
double temp = jsonObjectMain.getDouble("temp") - 273.15;
double feelsLike = jsonObjectMain.getDouble("feels_like") - 273.15;
float pressure = jsonObjectMain.getInt("pressure");
int humidity = jsonObjectMain.getInt("humidity");
JSONObject jsonObjectWind = jsonResponse.getJSONObject("wind");
String wind = jsonObjectWind.getString("speed");
JSONObject jsonObjectClouds = jsonResponse.getJSONObject("clouds");
String clouds = jsonObjectClouds.getString("all");
JSONObject jsonObjectSys = jsonResponse.getJSONObject("sys");
String countryName = jsonObjectSys.getString("country");
String cityName = jsonResponse.getString("name");
tvResult.setTextColor(Color.rgb(0,0,0));
output += "Current weather of " + cityName + " (" + countryName + ")"
+ "\n Temperature: " + df.format(temp) + " °C"
+ "\n Ground Level Temperature: " + df.format(feelsLike) + " °C"
+ "\n Humidity: " + humidity + "%"
+ "\n Description: " + description
+ "\n Wind Speed: " + wind + " m/s"
+ "\n Cloud Density: " + clouds + "%"
+ "\n Pressure: " + pressure + " hPa";
tvResult.setText(output);
} catch (JSONException e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener(){
@Override
public void onErrorResponse(VolleyError error){
Toast.makeText(getApplicationContext(), error.toString().trim(), Toast.LENGTH_SHORT).show();
}
});
RequestQueue requestQueue = Volley.newRequestQueue(getApplicationContext());
requestQueue.add(stringRequest);
}
}
}
50
CHAPTER-7
TESTING
7.1 INTRODUCTION
Software testing is a critical element of software quality assurance and represents the ultimate review of
specification, design and coding. In fact, testing is the one step in the software engineering process that could be
viewed as destructive rather than constructive. A strategy for software testing integrates software test case design
methods into a well-planned series of steps that result in the successful construction of software. Testing is the set
of activities that can be planned in advance and conducted systematically.
The software engineering process can be viewed as a spiral.Initially system engineering defines the role of
software and leads to software requirement analysis where the information domain, functions, behaviour,
performance, constraints and validation criteria for software are established.Moving inward along the spiral, we
come to design and finally to coding. To develop computer software we spiral in along streamlines that decrease
the level of abstraction on each turn. A strategy for software testing may also be viewed in the context of the spiral.
Unit testing begins at the vertex of the spiral and concentrates on each unit of the software as implemented in
source code. Talking another turn on outward on the spiral we encounter validation testing where requirements
established as part of software requirements analysis are validated against the software that has been constructed.
Unit testing focuses verification effort on the smallest unit of software design, the module. The unit testing we
have is white box oriented and some modules the steps are conducted in parallel. 7.3.1 WHITE BOX TESTING
To follow the concept of white box testing we have tested each form. We have created independently to verify that
Data flow is correct and all conditions are exercised to check their validity. ⮚ All loops are executed on their
boundaries. This type of testing ensures that all independent paths have been exercised at least once
⮚ All logical decisions have been exercised on their true and false sides
⮚ All loops are executed at their boundaries and within their operational bounds
51
⮚ All internal data structures have been exercised to assure their validity paths.
In this part of the testing each of the conditions were tested to both true and false aspects. And all the resulting
paths were tested so that each path that may generate on a particular condition is traced to uncover any possible
errors.
7.3.3 DATA FLOW TESTING
This type of testing selects the path of the program according to the location of definition and use of variables. This
kind of testing was used only when some local variable were declared. The definition-use chain method was used
in this type of testing.
7.3.4 LOOP TESTING
In this type of testing all the loops are tested to all the limits possible.
⮚ All the loops were tested at their limits, just above them and just below them. All the loops were skipped at least
once.
⮚ For nested loops test the inner most loop first and then work outwards. For concatenated loops the values of
dependent loops were set with the help of connected loop.
⮚ Unstructured loops were resolved into nested loops or concatenated loops and tested as above. ⮚ Each unit has
been separately tested by the development team itself and all the input have been validated.
A test case, in software engineering, is a set of conditions or variables under which a tester will determine whether
an application, software system or one of its features is working as it was originally established for it to do. The
mechanism for determining whether a software program or system has passed or failed such a test is known as a
test oracle. In some settings, an oracle could be a requirement or use case, while in others it could be a heuristic. It
may take many test cases to determine that a software program or system is considered sufficiently scrutinized to
be released. Test cases are often referred to as test scripts, particularly when written - when they are usually
collected into test suites.
52
CHAPTER -8
CONCLUSION AND FUTUREWORK
CHAPTER-9
REFERENCES