+ All Categories
Home > Documents > Assignment No A-06 Aim - E-STUDY

Assignment No A-06 Aim - E-STUDY

Date post: 13-Nov-2021
Category:
Upload: others
View: 0 times
Download: 0 times
Share this document with a friend
11
Assignment No A-06 Aim A Pizza shop chain wants to automate dishes served with schemes or without scheme and delivered by the nearest shop in a chain. Use pervasive computing paradigm to develop a web-application using Embedded Java/ Python/ Scala so that the order be delivered to the customer within 10 minutes. Use XML/JSON to store the data. Pre-requisite 1. Android. Objective 1. To understand idea of pervasive computing. 2. To develop the application for pizza shop. Problem Statement Implement a pizza shop application to automate the delivery of an order. Hardware / Software Used 1. Android Studio. 2. Android Phone. 1
Transcript
Page 1: Assignment No A-06 Aim - E-STUDY

Assignment No A-06

Aim

A Pizza shop chain wants to automate dishes served with schemes or without scheme anddelivered by the nearest shop in a chain. Use pervasive computing paradigm to develop aweb-application using Embedded Java/ Python/ Scala so that the order be delivered tothe customer within 10 minutes. Use XML/JSON to store the data.

Pre-requisite

1. Android.

Objective

1. To understand idea of pervasive computing.

2. To develop the application for pizza shop.

Problem Statement

Implement a pizza shop application to automate the delivery of an order.

Hardware / Software Used

1. Android Studio.

2. Android Phone.

1

Page 2: Assignment No A-06 Aim - E-STUDY

Mathematical Model

M={ s, e, X, Y, fme;DD;NDD; Ffriend;Memshared; Fsuccess; Ffailure;CPUCoreCount }•s= Input the details•e= The order is placed successfully•X=Input of the program.

1. X1=name

2. X2=address

3. X3=phone number

•Y=Output of the program.The particular product is delivered

•Fme= Functions in the program.

1. Select the items.

2. Place the order.

•DD= Deterministic data

1. Input co-ordinates are the deterministic data.

2. Accept function to get the details of the customer

•NDD=Non deterministic data

1. The location is tracked and the time and distance is calculated.

2. Any one will not predict that what will be the path for given coordinates.

•Memshared=No use of shared memory.

•Fsuccess=Correct work type is estimated.

•Ffailure= Fail to predict work type if there is no detail available.

•CPUCoreCount=1

2

Page 3: Assignment No A-06 Aim - E-STUDY

Theory

•Introduction:Data is stored on Parse cloud. Parse is a form of an application for the users to give the backend to launch an app. It provides its features for iOS, Android, and Windows applications.The Parse SDK offers all the elasticity of a cloud platform for the mobile applications that needto scale.

•Android SDK:The Android software development kit contains set of development tools used for the develop-ment. The tools consists of a debugger, libraries, documentation, sample code, and tutorials.Currently supported development platforms include computers running Linux (any moderndesktop Linux distribution), and Windows XP or later.•Steps:

1. Open the Pizza APP.

2. Enter the details.

3. Select the pizza from the menu.

4. Enter the address.

5. Post the order.

•Fetching of list:Gives the information about the address of the shops located in a particular city. The userselect the best destination to order the product which would be conventional to them to getthe best delivery. The list gets fetched from the parse cloud.

Procedure

Build and run the project in android studio.

Conclusion

We have studied to develop web application for a pizza shop with schemes or without schemeand delivered by the nearest shop in a chain using pervasive computing para dime.

3

Page 4: Assignment No A-06 Aim - E-STUDY

Program

==============================================================================================================================GROUP AAssignment No : B1Elective II BTitle : A Pizza shop chain wants to automate dishes served with schemes or withoutscheme and delivered by the nearest shop in a chain. Use pervasive computing paradimeto develop a web-application using Embedded Java/ Python/ Scala so that the order bedelivered to the customer within 10 minutes. Use XML/JSON to store the data.Roll No :Batch : BClass : BE ( Computer )==============================================================================================================================

MainActivity.java

package com.example.windows.pizza;

import android.app.Activity;

import android.content.Intent;

import android.os.Bundle;

import android.support.v7.app.AppCompatActivity;

import android.view.Menu;

import android.view.MenuItem;

import android.view.View;

import android.widget.Button;

import android.widget.EditText;

import android.widget.Toast;

import com.parse.ParseException;

import com.parse.ParseObject;

import com.parse.SaveCallback;

import java.util.Arrays;

import java.util.List;

import com.parse.FindCallback;

import com.parse.ParseQuery;

public class MainActivity extends AppCompatActivity {

EditText name, address, mobile;

Button next;

String sn,sa,sm;

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

name=(EditText) findViewById(R.id.editText);

address=(EditText) findViewById(R.id.editText2);

mobile=(EditText) findViewById(R.id.editText3);

next=(Button) findViewById(R.id.button);

Toast.makeText(MainActivity.this,sn,Toast.LENGTH_SHORT).show();

next.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View v) {

4

Page 5: Assignment No A-06 Aim - E-STUDY

ParseObject details = new ParseObject("Details");

sn=name.getText().toString();

sa=address.getText().toString();

sm=mobile.getText().toString();

details.put("customername", sn);

details.put("address", sa);

details.put("mobile", sm);

details.saveInBackground(new SaveCallback() {

@Override

public void done(ParseException e) {

if (e == null) {

Toast.makeText(MainActivity.this, "Successful!", Toast.LENGTH_SHORT).show();

} else {

Toast.makeText(MainActivity.this, "Failure!", Toast.LENGTH_SHORT).show();

}

}

});

Intent intent = new Intent(MainActivity.this, Center.class);

startActivity(intent);

}

});

}

@Override

public boolean onCreateOptionsMenu(Menu menu) {

// Inflate the menu; this adds items to the action bar if it is present.

getMenuInflater().inflate(R.menu.menu_main, menu);

return true;

}

@Override

public boolean onOptionsItemSelected(MenuItem item) {

// Handle action bar item clicks here. The action bar will

// automatically handle clicks on the Home/Up button, so long

// as you specify a parent activity in AndroidManifest.xml.

int id = item.getItemId();

//noinspection SimplifiableIfStatement

if (id == R.id.action_settings) {

return true;

}

return super.onOptionsItemSelected(item);

}

}

Center.java

package com.example.windows.pizza;

import android.app.Activity;

import android.location.Criteria;

import android.location.Location;

import android.location.LocationListener;

import android.location.LocationManager;

import android.support.v7.app.AppCompatActivity;

5

Page 6: Assignment No A-06 Aim - E-STUDY

import android.os.Bundle;

import android.support.v7.internal.widget.AdapterViewCompat;

import android.view.Menu;

import android.view.MenuItem;

import android.view.View;

import android.widget.AdapterView;

import android.widget.ArrayAdapter;

import android.widget.EditText;

import android.widget.Spinner;

import android.widget.TextView;

import android.widget.Toast;

import com.parse.FindCallback;

import com.parse.ParseException;

import com.parse.ParseObject;

import com.parse.ParseQuery;

import java.util.ArrayList;

import java.util.List;

public class Center extends Activity implements LocationListener {

Spinner li;

List<String> list = new ArrayList<String>();

TextView ce,di,ti;

Double dist[]=new Double[5];

Double listlat;

Double listlon;

Double timecalc;

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_center);

li=(Spinner) findViewById(R.id.spinner);

ce=(TextView) findViewById(R.id.cen);

di=(TextView) findViewById(R.id.dis);

ti=(TextView) findViewById(R.id.time);

LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);

Criteria criteria = new Criteria();

String bestProvider = locationManager.getBestProvider(criteria, true);

Location location = locationManager.getLastKnownLocation(bestProvider);

final double latitude = location.getLatitude();

final double longitude = location.getLongitude();

list.add("Select Center");

ParseQuery<ParseObject> fetchData = new ParseQuery<ParseObject>("NasikCenters");

fetchData.findInBackground(new FindCallback<ParseObject>() {

@Override

public void done(List<ParseObject> centerlist, ParseException e) {

if (e != null) {

Toast.makeText(Center.this, "Failure", Toast.LENGTH_SHORT).show();

}

else {

for (int i = 0; i < centerlist.size(); i++) {

list.add(centerlist.get(i).getString("CenterName"));

6

Page 7: Assignment No A-06 Aim - E-STUDY

listlat=Double.parseDouble(centerlist.get(i).getString("latitude"));

listlon=Double.parseDouble(centerlist.get(i).getString("longitude"));

dist[i]=distance(latitude,longitude,listlat,listlon);

}

}

}

});

ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, list);

// Drop down layout style - list view with radio button

dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

// attaching data adapter to spinner

li.setAdapter(dataAdapter);

li.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

@Override

public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {

Toast.makeText(getApplicationContext(), position + "is selected", Toast.LENGTH_SHORT).show();

String strAge=list.get(position).toString();

ce.setText("Center Selected is : "+strAge);

di.setText("Distance is : "+dist[position]);

timecalc=dist[position]*2+5;

ti.setText("Time : "+timecalc);

Toast.makeText(Center.this,strAge,Toast.LENGTH_SHORT).show();

}

@Override

public void onNothingSelected(AdapterView<?> parent) {

}

});

}

@Override

public boolean onCreateOptionsMenu(Menu menu) {

// Inflate the menu; this adds items to the action bar if it is present.

getMenuInflater().inflate(R.menu.menu_center, menu);

return true;

}

@Override

public boolean onOptionsItemSelected(MenuItem item) {

// Handle action bar item clicks here. The action bar will

// automatically handle clicks on the Home/Up button, so long

// as you specify a parent activity in AndroidManifest.xml.

int id = item.getItemId();

//noinspection SimplifiableIfStatement

if (id == R.id.action_settings) {

return true;

}

return super.onOptionsItemSelected(item);

}

public double distance(double lat1, double lng1, double lat2, double lng2) {

double earthRadius = 3958.75; // miles (or 6371.0 kilometers)

double dLat = Math.toRadians(lat2-lat1);

7

Page 8: Assignment No A-06 Aim - E-STUDY

double dLng = Math.toRadians(lng2-lng1);

double sindLat = Math.sin(dLat / 2);

double sindLng = Math.sin(dLng / 2);

double a = Math.pow(sindLat, 2) + Math.pow(sindLng, 2)

* Math.cos(Math.toRadians(lat1)) * Math.cos(Math.toRadians(lat2));

double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));

double dist = earthRadius * c;

return dist;

}

@Override

public void onLocationChanged(Location location) {

}

@Override

public void onStatusChanged(String provider, int status, Bundle extras) {

}

@Override

public void onProviderEnabled(String provider) {

}

@Override

public void onProviderDisabled(String provider) {

}

}

ParseInitialize.java

package com.example.windows.pizza;

import android.app.Application;

import com.parse.Parse;

/**

* Created by Swapnil on 02-09-2015.

*/

public class ParseInitializer extends Application {

@Override

public void onCreate() {

super.onCreate();

// Enable Local Datastore.

// Enable Local Datastore.

Parse.enableLocalDatastore(this);

Parse.initialize(this, "UuVD6smqL2mshSzxPDZOC7vae2oUS4QIlDh800uJ", "OYw8YgcV90nNTnkFWJJyoCHD47AtJwwu2EvViWJe");

}

}

8

Page 9: Assignment No A-06 Aim - E-STUDY

Output

9

Page 10: Assignment No A-06 Aim - E-STUDY

10

Page 11: Assignment No A-06 Aim - E-STUDY

Plagiarism Score

11


Recommended