text
stringlengths
3
1.18M
public class HelloWorld { public static void main(String[] args) { System.out.println("hello world"); } }
import javax.swing.*; public class oddeven { public static void main(String[] args) { String numbers = ""; numbers = JOptionPane.showInputDialog(null,"Please enter your number:"); double val = Double.parseDouble(numbers); if(val %2 == 0){ nu...
public class HelloWorld { public static void main(String[] args) { System.out.println("hello world"); } }
import javax.swing.*; public class userinput { public static void main(String[] args){ String num = ""; num = JOptionPane.showInputDialog(null,"Please enter your name"); JOptionPane.showMessageDialog(null,"Hi "+num); } }
import javax.swing.*; public class oddeven { public static void main(String[] args) { String numbers = ""; numbers = JOptionPane.showInputDialog(null,"Please enter your number:"); double val = Double.parseDouble(numbers); if(val %2 == 0){ nu...
class MyArrayList{ private int[]MyArray; private int size; public MyArrayList(int value, int seed,int inc){ MyArray = new int [value]; size = value; for (int i=0; i < size; i++){ MyArray[i]=seed; seed+= inc; } } public void PrintElement(){ for (int i=...
import javax.swing.*; public class userinput { public static void main(String[] args){ String num = ""; num = JOptionPane.showInputDialog(null,"Please enter your name"); JOptionPane.showMessageDialog(null,"Hi "+num); } }
public class Calculator2 { int x; int y; int z; public Calculator2 (int num1, int num2){ x = num1; y = num2; } public int addNumbers(){ return x+y; } public int subtractNumbers(){ z = x-y; return z; } public int multiplyNumbers(){ z = x*y; return z; ...
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package lenny; /** * * @author 101Lenboxs */ public class heloo { public static void main(String[] args) { System.out.println("hello"); } }
package com.controller; import java.util.ArrayList; import java.util.List; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; import org.json.JSONException; import org.json.JSONObject; import android.util.Log; import com.configuration.Configuration; import com.conf...
/* * This class will handle request in getting Meal information from Server * All the information would be wrapped in Meal Class object */ package com.controller; import java.util.ArrayList; import java.util.List; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; ...
package com.controller; import java.util.ArrayList; import java.util.List; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; import org.json.JSONException; import org.json.JSONObject; import android.util.Log; import com.configuration.Configuration; import com.user...
/* * This class will handle request in getting Meal Comment information from Server * All the information would be wrapped in MealComment Class object */ package com.controller; //need to fetch multiple comment import java.util.ArrayList; import java.util.List; import org.apache.http.NameValuePair; ...
/* * This class will handle request in getting Restaurant Comment information from Server * All the information would be wrapped in RestaurantComment Class object */ package com.controller; import java.util.ArrayList; import java.util.List; import org.apache.http.NameValuePair; import org.apache.http.m...
/* * This class will upload comment for meal by user */ package com.controller; import java.util.ArrayList; import java.util.List; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; import org.json.JSONException; import org.json.JSONObject; import android.util.Log...
/* * This class will handle request in getting Restaurant information from Server * All the information would be wrapped in Meal Class object */ package com.controller; import java.util.ArrayList; import java.util.List; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValue...
package com.controller; import java.util.ArrayList; import java.util.List; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; import org.json.JSONException; import org.json.JSONObject; import android.util.Log; import com.configuration.Configuration; import com.user...
/* * This class will handle request in getting User information from Server * All the information would be wrapped in User Class object */ package com.controller; import java.util.ArrayList; import java.util.List; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; i...
/* * LoginRegister handles Login and Register Function at the startup phase of the application */ package com.user; import java.util.ArrayList; import java.util.List; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; import org.json.JSONException; import org.json.JS...
/* * DatabaseHandler extends SQLiteOpenHelper * This class will manage the internal SQLite database for the Android */ package com.user; import java.util.ArrayList; import java.util.List; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import a...
package com.user; import java.util.Collections; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; import java.util.Map.Entry; import android.graphics.Bitmap; import android.util.Log; public class MemoryCache { private static final String TAG = "MemoryCache"; private Map<String,...
package com.user; import java.io.File; import android.content.Context; public class FileCache { private File cacheDir; public FileCache(Context context){ //Find the dir to save cached images if (android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUN...
package com.user; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; import java.util.Collections; import...
package com.user; import android.app.ActionBar.LayoutParams; import android.content.Context; import android.net.ConnectivityManager; import android.view.View; import android.view.ViewGroup; import android.view.View.MeasureSpec; import android.widget.ListAdapter; import android.widget.ListView; public class...
/* * Contact Class is used for handling the owners's account on the device */ package com.user; public class Contact { //private variables private int _id; private String _name; private String _telephone; // Empty constructor public Contact(){ } // constructor ...
/* * This JSONPararser acts as a helper class to handle httpRequest result * returned by server. It accepts two types of Http method, POST and GET */ package com.user; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Unsupport...
package com.user; import java.io.InputStream; import java.io.OutputStream; public class Utils { public static void CopyStream(InputStream is, OutputStream os) { final int buffer_size=1024; try { byte[] bytes=new byte[buffer_size]; for(;;) { ...
/* * Meal class is an object relating to each meal in the server */ package com.object; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import com.configuration.Configuration; public class Meal { private int _id; private int _restaurant; // The meal belongs to which rest...
/* * Restaurant class is an object relating to each restaurant account in the server */ package com.object; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import com.configuration.Configuration; public class Restaurant { private int _id; // Restaurant ID of the resta...
/* * User class is an object relating to each user account in the server */ package com.object; public class User { private int _id; //User ID of the user (relative to the table user->id field) private String _name; //Username of the user private String _description; //Description of the user p...
/* * MealComment class is an object relating to each meal comment in the server */ package com.object; public class MealComment { private int _id; //Comment Id private int _user; //User id of the user who gives this comment private int _meal; //Meal id of the restaurant this comment belongs to p...
/* * RestaurantComment class is an object relating to each restaurant comment in the server */ package com.object; public class RestaurantComment { private int _id; //Comment Id private int _user; //User id of the user who gives this comment private int _restaurant; //Restaurant id of the restaurant...
package com.configuration; public class Configuration { /* * isDebug tells if we are running this programming in debug mode * running in debug mode will show all debug message * true : Debug Mode is on * false : Debug Mode is off * * Default Value = false */ public final static boolean...
/* * This class stores all the information of the user when the app starts * Only update this class in 2 situations * - After successful non-SMS login * - After successful SMS login */ package com.configuration; public class Owner { public static int id; public static String telephone; public stat...
package com.comp3111.happymeal; import com.configuration.*; import com.controller.UserFetch; import com.controller.UserUpdate; import com.object.User; import com.user.*; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.View;...
package com.comp3111.happymeal; import java.io.InputStream; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import com.configuration.Configuration; import com.configuration.Owner; import com.controller.RestaurantCommentUpdate; import ...
/* * This Activity would be the landing activity of the app * This activity will determine whether the user has logined or not * If fail to login, redirect to LoginActivity.java for login/register account * If successful login, redirect to DiscoverPageActivity.java */ package com.comp3111.happ...
package com.comp3111.happymeal; import org.json.JSONException; import org.json.JSONObject; import com.configuration.Configuration; import com.user.LoginRegister; import android.view.View.OnClickListener; import android.app.Activity; import android.app.AlertDialog; import android.app.ProgressDialog; import android.co...
package com.comp3111.happymeal; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; import android.annotation.SuppressLint; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable...
package com.comp3111.happymeal; import com.comp3111.happymeal.NavigationDrawerActivity; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; impor...
package com.comp3111.happymeal; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.AsyncTask; import android.widget.ImageView; public class DownloadImagesForImageView extends AsyncTa...
package com.comp3111.happymeal; import org.json.JSONException; import org.json.JSONObject; import com.configuration.Configuration; import com.user.LoginRegister; import android.app.Activity; import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.DialogInterface; import ...
package com.comp3111.happymeal; import com.configuration.Configuration; import com.configuration.Owner; import com.controller.UserUpdate; import com.user.Contact; import com.user.DatabaseHandler; import com.user.LoginRegister; import android.app.Activity; import android.content.Intent; import android.os.Bu...
package com.comp3111.happymeal; import java.io.InputStream; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import com.configuration.Configuration; import com.configuration.Owner; import com.controller.MealCommentFetch; import com.con...
package com.comp3111.happymeal; import java.io.InputStream; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import com.configuration.Configuration; import com.controller.*; import com.object.*; import android.content.Intent; import a...
package com.comp3111.happymeal; import java.util.ArrayList; import java.util.HashMap; import android.app.Activity; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.Button; import androi...
package com.comp3111.happymeal; import java.io.InputStream; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import com.configuration.Configuration; import com.configuration.Owner; import com.controller.*; import com.object.*; import com.user.Help...
package com.comp3111.happymeal; import java.util.ArrayList; import java.util.List; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; import org.json.JSONException; import org.json.JSONObject; import com.user.JSONParser; import android.app.Activity; import android.app.AlertDial...
package com.comp3111.happymeal; import java.io.InputStream; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import com.configuration.Configuration; import com.configuration.Owner; import com.controller.MealCommentFetch; import com.con...
package com.comp3111.happymeal; import java.io.InputStream; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import com.configuration.Configuration; import com.configuration.Owner; import com.controller.MealCommentFetch; import com.con...
package com.comp3111.happymeal; import com.configuration.Owner; import android.app.Activity; import android.app.ProgressDialog; import android.content.Intent; import android.view.Menu; import android.os.Handler; import android.support.v4.widget.DrawerLayout; import android.widget.*; import android.view.View; public ...
package com.comp3111.happymeal; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.w...
package com.comp3111.happymeal; import java.io.InputStream; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import com.configuration.Configuration; import com.controller.MealFetch; import com.controller.RestaurantFetch; import com.obj...
/** Automatically generated file. DO NOT MODIFY */ package com.comp3111.happymeal.test; public final class BuildConfig { public final static boolean DEBUG = true; }
/** Automatically generated file. DO NOT MODIFY */ package com.comp3111.happymeal; public final class BuildConfig { public final static boolean DEBUG = true; }
package com.controller; import java.util.ArrayList; import java.util.List; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; import org.json.JSONException; import org.json.JSONObject; import android.util.Log; import com.configuration.Configuration; import com.conf...
/* * This class will handle request in getting Meal information from Server * All the information would be wrapped in Meal Class object */ package com.controller; import java.util.ArrayList; import java.util.List; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; ...
package com.controller; import java.util.ArrayList; import java.util.List; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; import org.json.JSONException; import org.json.JSONObject; import android.util.Log; import com.configuration.Configuration; import com.user...
/* * This class will handle request in getting Meal Comment information from Server * All the information would be wrapped in MealComment Class object */ package com.controller; //need to fetch multiple comment import java.util.ArrayList; import java.util.List; import org.apache.http.NameValuePair; ...
/* * This class will handle request in getting Restaurant Comment information from Server * All the information would be wrapped in RestaurantComment Class object */ package com.controller; import java.util.ArrayList; import java.util.List; import org.apache.http.NameValuePair; import org.apache.http.m...
/* * This class will upload comment for meal by user */ package com.controller; import java.util.ArrayList; import java.util.List; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; import org.json.JSONException; import org.json.JSONObject; import android.util.Log...
/* * This class will handle request in getting Restaurant information from Server * All the information would be wrapped in Meal Class object */ package com.controller; import java.util.ArrayList; import java.util.List; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValue...
package com.controller; import java.util.ArrayList; import java.util.List; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; import org.json.JSONException; import org.json.JSONObject; import android.util.Log; import com.configuration.Configuration; import com.user...
/* * This class will handle request in getting User information from Server * All the information would be wrapped in User Class object */ package com.controller; import java.util.ArrayList; import java.util.List; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; i...
/* * LoginRegister handles Login and Register Function at the startup phase of the application */ package com.user; import java.util.ArrayList; import java.util.List; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; import org.json.JSONException; import org.json.JS...
/* * DatabaseHandler extends SQLiteOpenHelper * This class will manage the internal SQLite database for the Android */ package com.user; import java.util.ArrayList; import java.util.List; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import a...
package com.user; import android.app.ActionBar.LayoutParams; import android.content.Context; import android.net.ConnectivityManager; import android.view.View; import android.view.ViewGroup; import android.view.View.MeasureSpec; import android.widget.ListAdapter; import android.widget.ListView; public class...
/* * Contact Class is used for handling the owners's account on the device */ package com.user; public class Contact { //private variables private int _id; private String _name; private String _telephone; // Empty constructor public Contact(){ } // constructor ...
/* * This JSONPararser acts as a helper class to handle httpRequest result * returned by server. It accepts two types of Http method, POST and GET */ package com.user; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Unsupport...
/* * Meal class is an object relating to each meal in the server */ package com.object; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import com.configuration.Configuration; public class Meal { private int _id; private int _restaurant; // The meal belongs to which rest...
/* * Restaurant class is an object relating to each restaurant account in the server */ package com.object; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import com.configuration.Configuration; public class Restaurant { private int _id; // Restaurant ID of the resta...
/* * User class is an object relating to each user account in the server */ package com.object; public class User { private int _id; //User ID of the user (relative to the table user->id field) private String _name; //Username of the user private String _description; //Description of the user p...
/* * MealComment class is an object relating to each meal comment in the server */ package com.object; public class MealComment { private int _id; //Comment Id private int _user; //User id of the user who gives this comment private int _meal; //Meal id of the restaurant this comment belongs to p...
/* * RestaurantComment class is an object relating to each restaurant comment in the server */ package com.object; public class RestaurantComment { private int _id; //Comment Id private int _user; //User id of the user who gives this comment private int _restaurant; //Restaurant id of the restaurant...
package com.configuration; public class Configuration { /* * isDebug tells if we are running this programming in debug mode * running in debug mode will show all debug message * true : Debug Mode is on * false : Debug Mode is off * * Default Value = false */ public final static boolean...
/* * This class stores all the information of the user when the app starts * Only update this class in 2 situations * - After successful non-SMS login * - After successful SMS login */ package com.configuration; public class Owner { public static int id; public static String telephone; public stat...
package com.comp3111.happymeal; import com.configuration.*; import com.controller.UserFetch; import com.controller.UserUpdate; import com.object.User; import com.user.*; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.View;...
package com.comp3111.happymeal; import java.io.InputStream; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import com.configuration.Configuration; import com.configuration.Owner; import com.controller.RestaurantCommentUpdate; import ...
/* * This Activity would be the landing activity of the app * This activity will determine whether the user has logined or not * If fail to login, redirect to LoginActivity.java for login/register account * If successful login, redirect to DiscoverPageActivity.java */ package com.comp3111.happ...
package com.comp3111.happymeal; import org.json.JSONException; import org.json.JSONObject; import com.configuration.Configuration; import com.user.LoginRegister; import android.view.View.OnClickListener; import android.app.Activity; import android.app.AlertDialog; import android.app.ProgressDialog; import android.co...
package com.comp3111.happymeal; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; import android.annotation.SuppressLint; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable...
package com.comp3111.happymeal; import com.comp3111.happymeal.NavigationDrawerActivity; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; impor...
package com.comp3111.happymeal; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.AsyncTask; import android.widget.ImageView; public class DownloadImagesForImageView extends AsyncTa...
package com.comp3111.happymeal; import org.json.JSONException; import org.json.JSONObject; import com.configuration.Configuration; import com.user.LoginRegister; import android.app.Activity; import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.DialogInterface; import ...
package com.comp3111.happymeal; import com.configuration.Configuration; import com.configuration.Owner; import com.controller.UserUpdate; import com.user.Contact; import com.user.DatabaseHandler; import com.user.LoginRegister; import android.app.Activity; import android.content.Intent; import android.os.Bu...
package com.comp3111.happymeal; import java.io.InputStream; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import com.configuration.Configuration; import com.configuration.Owner; import com.controller.MealCommentFetch; import com.con...
package com.comp3111.happymeal; import java.io.InputStream; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import com.configuration.Configuration; import com.controller.*; import com.object.*; import android.content.Intent; import a...
package com.comp3111.happymeal; import java.io.InputStream; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import com.configuration.Configuration; import com.configuration.Owner; import com.controller.*; import com.object.*; import com.user.Help...
package com.comp3111.happymeal; import java.io.InputStream; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import com.configuration.Configuration; import com.configuration.Owner; import com.controller.MealCommentFetch; import com.con...
package com.comp3111.happymeal; import java.io.InputStream; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import com.configuration.Configuration; import com.configuration.Owner; import com.controller.MealCommentFetch; import com.con...
package com.comp3111.happymeal; import com.configuration.Owner; import android.app.Activity; import android.app.ProgressDialog; import android.app.SearchManager; import android.content.Context; import android.content.Intent; import android.view.Menu; import android.view.MenuInflater; import android.os.Handler; import...
package com.comp3111.happymeal; import java.io.InputStream; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import com.configuration.Configuration; import com.controller.MealFetch; import com.controller.RestaurantFetch; import com.obj...
package com.comp3111.happymeal; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import android.app.Activity; import android.app.ListActivity; import android.os.Bundle; import android.widget.ListView; import android.widget.SimpleAdapter; public class Fol...
package blackjack; import java.util.LinkedList; public class Hand { public LinkedList<Card> cards = new LinkedList<Card>(); // Contructor - deal two cards public Hand() { cards.add(new Card()); cards.add(new Card()); } public boolean hasAce() { boolean ace = false; for (Card c : card...
package blackjack; import java.security.SecureRandom; public class Card { int cardNum; int cardVal; int suitNum; String cardName; String suitName; String fullName; SecureRandom generator = new SecureRandom(); //Constructor public Card(){ cardNum = 1+generator.nextInt(13); suitNum = gen...
package blackjack; import java.util.LinkedList; import javax.swing.JOptionPane; public class Game { // why do these need to be static? wtf is static anyways? static String dShowingStr; static String dCountStr; static Hand pHand; static Hand dHand; static boolean dFlip = false; LinkedList<Car...
package blackjack; import javax.swing.JOptionPane; public class Status { //Constructor public Status(Hand dHand, Hand pHand, boolean dFlip){ int dTotal; String dCards; if (dFlip) {dTotal = dHand.count();} else {dTotal = dHand.hiddenCount();} if (dFlip) {dCards = dHand.cardList();} else {d...
package blackjack; import javax.swing.JOptionPane; public class Popup { public Popup() { JOptionPane.showMessageDialog( null, "Popup Content", "Popup Title", JOptionPane.INFORMATION_MESSAGE ); } public Popup(String content) { JOptionPane.showMessageDialog( null, ...
/** * */ package gov.nasa.worldwind.formats.models.loader; import gov.nasa.worldwind.formats.models.ModelLoadException; import gov.nasa.worldwind.formats.models.geometry.Mesh; import gov.nasa.worldwind.formats.models.geometry.Model; import junit.framework.TestCase; /** * @author Tisham * */ public...
/* * ColladaLoader.java create 3/12/2010 * This loader implements geometry * creation of Collada models * * A collada file contains scenes, which use geometries. * Geometries have vertices, faces (polygons), materials * The materials are stored in their own library */ package gov.nasa.worldwind.form...