text stringlengths 3 1.18M |
|---|
/***************************************************************
JADE - Java Agent DEvelopment Framework is a framework to develop
multi-agent systems in compliance with the FIPA specifications.
Jade is Copyright (C) 2000 CSELT S.p.A.
This file copyright (c) 2001 Hewlett-Packard Corp.
GNU Lesser General Public L... |
/*****************************************************************
JADE - Java Agent DEvelopment Framework is a framework to develop
multi-agent systems in compliance with the FIPA specifications.
Jade is Copyright (C) 2000 CSELT S.p.A.
This file copyright (c) 2001 Hewlett-Packard Corp.
GNU Lesser General Public... |
/**
* ***************************************************************
* JADE - Java Agent DEvelopment Framework is a framework to develop
* multi-agent systems in compliance with the FIPA specifications.
* Copyright (C) 2000 CSELT S.p.A.
*
* GNU Lesser General Public License
*
* This library is free s... |
/**
* ***************************************************************
* JADE - Java Agent DEvelopment Framework is a framework to develop
* multi-agent systems in compliance with the FIPA specifications.
* Copyright (C) 2000 CSELT S.p.A.
*
* GNU Lesser General Public License
*
* This library is free s... |
/**
* ***************************************************************
* JADE - Java Agent DEvelopment Framework is a framework to develop
* multi-agent systems in compliance with the FIPA specifications.
* Copyright (C) 2000 CSELT S.p.A.
*
* GNU Lesser General Public License
*
* This library is free s... |
/*****************************************************************
JADE - Java Agent DEvelopment Framework is a framework to develop
multi-agent systems in compliance with the FIPA specifications.
Copyright (C) 2000 CSELT S.p.A.
GNU Lesser General Public License
This library is free software; you can redistr... |
/*****************************************************************
JADE - Java Agent DEvelopment Framework is a framework to develop
multi-agent systems in compliance with the FIPA specifications.
Copyright (C) 2000 CSELT S.p.A.
GNU Lesser General Public License
This library is free software; you can redistr... |
/*****************************************************************
JADE - Java Agent DEvelopment Framework is a framework to develop
multi-agent systems in compliance with the FIPA specifications.
Copyright (C) 2000 CSELT S.p.A.
GNU Lesser General Public License
This library is free software; you can redistr... |
/*****************************************************************
JADE - Java Agent DEvelopment Framework is a framework to develop
multi-agent systems in compliance with the FIPA specifications.
Copyright (C) 2000 CSELT S.p.A.
GNU Lesser General Public License
This library is free software; you can redistr... |
/*****************************************************************
JADE - Java Agent DEvelopment Framework is a framework to develop
multi-agent systems in compliance with the FIPA specifications.
Copyright (C) 2000 CSELT S.p.A.
GNU Lesser General Public License
This library is free software; you can redistr... |
package examples.messaging.alias;
import jade.core.Agent;
import jade.core.behaviours.CyclicBehaviour;
import jade.core.messaging.MessagingHelper;
import jade.core.messaging.MessagingService;
import jade.lang.acl.ACLMessage;
/**
* This example shows how an agent can declare an ALIAS, i.e. an additional name... |
/*****************************************************************
JADE - Java Agent DEvelopment Framework is a framework to develop
multi-agent systems in compliance with the FIPA specifications.
Copyright (C) 2000 CSELT S.p.A.
GNU Lesser General Public License
This library is free software; you can redistri... |
/*****************************************************************
JADE - Java Agent DEvelopment Framework is a framework to develop
multi-agent systems in compliance with the FIPA specifications.
Copyright (C) 2000 CSELT S.p.A.
GNU Lesser General Public License
This library is free software; you can redistri... |
/*****************************************************************
JADE - Java Agent DEvelopment Framework is a framework to develop
multi-agent systems in compliance with the FIPA specifications.
Copyright (C) 2000 CSELT S.p.A.
GNU Lesser General Public License
This library is free software; you can redistr... |
package AOP;
import jade.lang.acl.ACLMessage;
import java.util.ArrayList;
import Messages.AMessage;
import Messages.AMessage.GlobalNames;
public class Printer
{
private static ArrayList<ArrayList<String[]>> regions = new ArrayList<ArrayList<String[]>>();
private static boolean error = false;
... |
package AOP;
import Messages.AMessage;
import Messages.AMessage.GlobalNames;
import com.sun.org.omg.CORBA.ParameterModeHelper;
import jade.core.Profile;
import jade.core.ProfileException;
import jade.core.ProfileImpl;
import jade.core.Runtime;
import jade.tools.rma.rma;
import jade.util.leap.Properties;
import jade... |
package AOP;
import Messages.AMessage;
import jade.core.Profile;
import jade.core.ProfileException;
import jade.core.ProfileImpl;
import jade.core.Runtime;
import jade.tools.rma.rma;
import jade.wrapper.AgentController;
import jade.wrapper.ContainerController;
import jade.wrapper.StaleProxyException;
... |
package Behavior;
public class AdjustBehavior
{
}
|
package Behavior;
import jade.core.*;
import jade.core.behaviours.CyclicBehaviour;
import jade.lang.acl.ACLMessage;
import Messages.AMessage;
import Agents.Messageable;
import Agents.Sensor.ASensor;
public class MeasureRequesterBehavior extends CyclicBehaviour
{
private AMessage.Units unit;
public Me... |
package Behavior;
import AOP.Printer;
import Agents.AActuator;
import Agents.Messageable;
import Messages.AMessage;
import jade.core.AID;
import jade.core.Agent;
import jade.core.behaviours.TickerBehaviour;
import jade.lang.acl.ACLMessage;
public class EmitBehavior extends TickerBehaviour
{
public E... |
package Behavior;
import jade.core.Agent;
import jade.core.behaviours.TickerBehaviour;
import jade.lang.acl.ACLMessage;
import Messages.AMessage;
import AOP.Printer;
import Agents.AActuator;
import Agents.Messageable;
import Agents.Sensor.ASensor;
@SuppressWarnings("serial")
public class MeasureInformer... |
package Messages;
import Agents.Messageable;
public class NotUnderstoodMessage extends AMessage
{
private static final String ErrorMessageSplitter = " did not understand: ";
private static final String ErrorSender = " from ";
public MessageType notUnderstood;
public String from;
protected String ... |
package Messages;
import jade.core.Agent;
import Agents.Messageable;
public class NotifyMessage extends AMessage
{
protected String constructSpecialMessage(Messageable agent)
{
return ((Agent)agent).getLocalName();
}
protected String constructSpecialMessage(Messageable agent, MessageType type)
{
... |
package Messages;
import jade.core.Agent;
import jade.domain.AMSService;
import jade.domain.FIPAAgentManagement.AMSAgentDescription;
import jade.domain.FIPAAgentManagement.SearchConstraints;
import jade.lang.acl.ACLMessage;
import Agents.Messageable;
import Messages.OfficeRegionMessages.AdjustToUser;
public... |
package Messages;
import jade.core.Agent;
import Agents.AActuator;
import Agents.Messageable;
public class EmitMessage extends AMessage
{
public Units unit;
public int value;
protected String constructSpecialMessage(Messageable agent)
{
return ((Agent)agent).getLocalName() + AMessage.senderSplit... |
package Messages;
import Agents.Messageable;
import Agents.OfficeRegion;
import Agents.VacuumCleaner;
import Messages.AMessage.MessageType;
import Messages.AMessage.Units;
public class VacuumCleanerMessage extends AMessage
{
public VacuumStatus status;
public int timeToUse;
public int dirtyPct;
publi... |
package Messages;
import jade.core.Agent;
import Agents.Sensor.ASensor;
import Agents.Messageable;
public class MeasureMessage extends AMessage
{
public Units unit;
public int value;
protected String constructSpecialMessage(Messageable agent)
{
return ((Agent)agent).getLocalName() + AMessage.sen... |
package Messages;
import jade.core.Agent;
import Agents.Messageable;
import Agents.AUser;
public class UserMessage extends AMessage
{
public int location_x;
public int location_y;
public int temperature;
public int noise;
public int light;
public int garbageWeight;
public int garbageVolume;
... |
package Messages;
import jade.core.Agent;
import Agents.AOfficeRegion;
import Agents.Messageable;
public class OfficeRegionMessage extends AMessage
{
//public enum Command { };
protected static final String officeToAgent = " Commando_to ";
protected static final String agentDo = " To_do ";
protected s... |
package Messages;
import Agents.Messageable;
import Agents.Bin;
public class BinMessage extends AMessage
{
public int weight;
public int volume;
public int speed;
protected String constructSpecialMessage(Messageable agent)
{
return null;
}
protected String constructSpecialMessage(Messagea... |
package Messages.OfficeRegionMessages;
import Agents.AOfficeRegion;
import Agents.Messageable;
import Messages.AMessage;
import Messages.OfficeRegionMessage;
public class AdjustToUser extends OfficeRegionMessage
{
public Units unit;
public int value;
@Override
protected String constructSpecialMessage(... |
package Agents;
import jade.core.AID;
import jade.core.Agent;
import jade.core.behaviours.*;
import jade.domain.*;
import jade.domain.FIPAAgentManagement.*;
import jade.lang.acl.ACLMessage;
import AOP.Printer;
import Messages.AMessage;
import Messages.NotUnderstoodMessage;
import Messages.AMessage.MessageTy... |
package Agents;
import Messages.AMessage;
import Messages.AMessage.Units;
@SuppressWarnings("serial")
public abstract class AUser extends Messageable
{
public Units unitTemp = AMessage.Units.TEMPERATURE;
public Units unitLight = AMessage.Units.LIGHT;
public Units unitNoise = AMessage.Units.NOISE;
publi... |
package Agents;
import java.util.HashMap;
import Messages.AMessage.GlobalNames;
@SuppressWarnings("serial")
public abstract class AOfficeRegion extends Messageable
{
public int pctDirty = 0;
public boolean isVeryDirty = false;
public int preferenceTemperature = 60;
public int preferenceLight = 40;
... |
package Agents;
import jade.core.AID;
import jade.core.behaviours.CyclicBehaviour;
import jade.domain.DFService;
import jade.domain.FIPAException;
import jade.domain.FIPAAgentManagement.DFAgentDescription;
import jade.domain.FIPAAgentManagement.ServiceDescription;
import jade.lang.acl.ACLMessage;
import AOP.P... |
package Agents.Sensor;
import Agents.Messageable;
import Messages.AMessage.Units;
@SuppressWarnings("serial")
public abstract class ASensor extends Messageable
{
public Units unit;
public int value;
public abstract void getMeasuredValue();
}
|
package Agents.Sensor;
import AOP.Printer;
import Agents.Messageable;
import Messages.AMessage;
import Messages.EmitMessage;
import Messages.MeasureMessage;
import Messages.NotUnderstoodMessage;
import jade.core.Agent;
import jade.core.behaviours.*;
import jade.lang.acl.ACLMessage;
@SuppressWarnings("seri... |
package Agents;
import jade.core.Agent;
import jade.core.behaviours.CyclicBehaviour;
@SuppressWarnings("serial")
public abstract class Messageable extends Agent
{
}
|
package Agents;
import Messages.AMessage.Units;
@SuppressWarnings("serial")
public abstract class AActuator extends Messageable
{
public Units unit;
public int value;
public int setpoint;
public int currentpoint;
public abstract void calculateNewValue();
}
|
package Agents;
import AOP.Printer;
import Messages.AMessage;
import jade.core.AID;
import jade.core.Agent;
import jade.core.behaviours.CyclicBehaviour;
import jade.core.behaviours.TickerBehaviour;
import jade.lang.acl.ACLMessage;
@SuppressWarnings("serial")
public class User extends AUser
{
protected ... |
//package dk.sdu.mmmi.AOP;
import jade.core.Profile;
import jade.core.ProfileImpl;
import jade.core.Runtime;
import jade.tools.rma.rma;
import jade.wrapper.AgentController;
import jade.wrapper.ContainerController;
import jade.wrapper.StaleProxyException;
public class StartAgentPlatform {
/**
* @param args
*/
... |
/**
* ***************************************************************
* JADE - Java Agent DEvelopment Framework is a framework to develop
* multi-agent systems in compliance with the FIPA specifications.
* Copyright (C) 2000 CSELT S.p.A.
*
* GNU Lesser General Public License
*
* This library is free s... |
public static String constructMessage(Messageable agent, MessageType type) {
...
switch(type) {
case MEASUREMENT:
am = new MeasureMessage();
returnerString = type.get() + AMessage.messageSplit + am.constructSpecialMessage(agent);
break;
case EMIT:
am = new EmitMessage();
... |
serviceNeeded.setType(AMessage.GlobalNames.VACUUM_CLEANER_AGENT.get());
agentNeeded.addServices(serviceNeeded);
DFAgentDescription[] possibleAgents = DFService.search((Agent)myAgent, agentNeeded); |
ACLMessage accMsg = new ACLMessage(ACLMessage.ACCEPT_PROPOSAL);
accMsg.setContent(AMessage.constructMessage((Messageable)myAgent, AMessage.MessageType.NOTIFY_ONLY));
accMsg.addReceiver(new AID(fastestVC,AID.ISLOCALNAME));
send(accMsg);
possibleVacuumCleaners.clear(); |
protected String constructSpecialMessage(Messageable agent) {
return ((Agent)agent).getLocalName() + AMessage.senderSplit +
((AActuator)agent).unit.name() + AMessage.unitSplit +
((AActuator)agent).value;
} |
protected void onTick() {
((AActuator) myAgent).calculateNewValue();
if(((AActuator)myAgent).value > 0) {
ACLMessage message = new ACLMessage( ACLMessage.INFORM );
message.setContent(AMessage.constructMessage((Messageable)myAgent, AMessage.MessageType.EMIT));
AMessage.broadcastToAll((Messageable)my... |
ServiceDescription sd = (ServiceDescription) it.next();
ACLMessage cfpMsg = new ACLMessage(ACLMessage.CFP);
cfpMsg.addReceiver(new AID(provider.getLocalName(),AID.ISLOCALNAME));
cfpMsg.setContent(AMessage.constructMessage((Messageable)myAgent, AMessage.MessageType.CALL_CLEAN));
myAgent.send(cfpMsg); |
class HandleMessagesBehaviour extends CyclicBehaviour
get next ACLMessage in queue
if (message found)
message = content of ACLMessage;
switch (message sender)
if (sender is one of the agents to communicate with)
switch (ACLMessage performatives)
if (performative match is found)
retrieve ... |
if (clean) {
Power remaining is decreased. If below 5: status = NEED_POWER.
INFORM message send to the agent being cleaned (office region or bin). The message will be interpreted as cleaning is being performed. Thereby the amount of dirt is decreased.
}
if (status == AMessage.VacuumStatus.NEED_POWER) ... |
if (msg.getPerformative() == ACLMessage.CFP) {
if (status == VacuumStatus.IDLE) {
int workload = ((Messages.VacuumCleanerMessage)message).dirtyPct;
timeToUseOnTask = (workload / speed) * (powerRemaining/5);
reply.setPerformative(ACLMessage.PROPOSE);
String con = AMessage.constructMess... |
else if(GlobalNames.decode(message.getSender()) == GlobalNames.USER_AGENT) {
if(msg.getPerformative() == ACLMessage.INFORM) {
UserMessage um = (UserMessage)message;
if( GlobalNames.getAreaCode(myAgent.getLocalName()).equalsIgnoreCase(
Integer.toString(um.location_x)+Integer.toString(um.location_y)... |
clean = true;
currentJob = message.getSender();
sendReply = false;
status = VacuumStatus.VACUUMING; |
public static AMessage retrieveMessage(String aMessage) {
AMessage message = null;
String[] information = aMessage.split(AMessage.messageSplit);
MessageType type = MessageType.decode(information[0]);
String theMessage = information[1];
switch(type) {
case MEASUREMENT:
message = new Measur... |
package javaapplication1;
class Calclib {
int x;
int y;
int z;
public Calclib(int num1, int num2) {
x= num1;
y=num2;
}
public int addNumber() {
z = x+y;
return z;
}
public int subtractNumbers() {
z = x-y;
return z;
}
}
public class Calculator {
public static void ... |
import javax.swing.*;
public class oddorevennumber {
public static void main(String[] args){
String num = "";
num = JOptionPane.showInputDialog(null, "Please enter a number to determine if it is odd or even");
JOptionPane.showMessageDialog(null, num)
}
}
|
import javax.swing.*;
public class UserInput{
public static void main(Strig[] orgs) {
String num = **;
num= JOption.showInputDialog(null, " PLease enter your name:");
JOpitionPane.showMessageDialog(null,"Hi"+num);
}
} |
import javax.swing.*;
public class oddEven
{
public static void main(String[] args)
{
int number;
number = Integer.parseInt(JOptionPane.showInputDialog( null, "Please enter a number: " ));
OddNumber ( number );
EvenNumber ( number );
}
private static void OddNumber ( int num )
{
... |
import javax.swing.*;
public class helloWorld {
public static void main(String[] args) {
JOptionPane.showMessageDialog( null, "Hello World!" );
}
} |
import javax.swing.*;
public class helloWorld {
public static void main(String[] args) {
JOptionPane.showMessageDialog( null, "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 + "!");
}
} |
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;
... |
import java.util.Random;
class sortArray
{
private int[] myArray;
public sortArray()
{
System.out.println("Default Order:");
Random digit = new Random();
myArray = new int [10];
for ( int counter = 0 ; counter < 10 ; counter++ )
{
myArray[counter] = 1 + digit.nextInt(10);
}
printEleme... |
class myArrayList {
private int[] myArray;
private int size;
public myArrayList( int value, int seed, int increment ) {
myArray = new int [value];
size = value;
for ( int counter = 0 ; counter < size ; counter++ ) {
myArray[counter] = seed;
seed += increment;
}
}
public void printElement... |
class stackClass {
private int maxSize;
private char[] stackArray;
private int top;
public stackClass(int max) {
maxSize = max;
stackArray = new char[maxSize];
top = -1;
}
public void push(char j) {
stackArray[++top] = j;
}
... |
import java.io.IOException;
public class reverseStack {
private String input;
private String output;
public reverseStack(String in) {
input = in;
}
public String doRev() {
int stackSize = input.length();
Stack theStack = new Stack(stackSize);
for (int i = 0; i < in... |
import java.util.Random;
class sortArray
{
private int[] myArray;
public sortArray()
{
System.out.println("Default Order:");
Random digit = new Random();
myArray = new int [10];
for ( int counter = 0 ; counter < 10 ; counter++ )
{
myArray[counter] = 1 + digit.nextInt(10);
}
printEleme... |
/*
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by app... |
/**
*
*/
package android.location;
import java.util.List;
import android.app.PendingIntent;
import android.os.Bundle;
import android.os.RemoteException;
import com.android.internal.location.ProviderProperties;
/**
* @author steven.lam.t.f
*
*/
public interface ILocationManager{
public abstr... |
/*
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless requir... |
/**
*
*/
package steven.graph;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Set;
/**
* @author Steven
*
*/
public class Graph<T extends INode<T>>{
priv... |
/**
*
*/
package steven.graph;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* @author Steven
*
*/
public class Node<T extends INode<T>> implements Comparable<Node<T>>{
private final T content;
private final List<Edge<T>> edges = new ArrayList<Edge<T>>();
@Sup... |
/**
*
*/
package steven.graph;
/**
* @author Steven
*
*/
public class Edge<T extends INode<T>> implements Comparable<Edge<T>>{
private final Node<T> node;
private final int distance;
public Edge(final Node<T> node, final int distance){
this.node = node;
this.distance = distance;
}
@Over... |
/**
*
*/
package steven.graph;
/**
* @author Steven
*
*/
public interface INode<T extends INode<T>>{
public int getHeuristic(T to);
public Node<T> getNode();
}
|
/**
*
*/
package steven.sth;
/**
* @author steven.lam.t.f
*
*/
public class S20141206FloatDoubleTest{
public static final void main(final String[] args){
final double a = 22.341768;
double b = a + 0.000051234125;
b += 0.000051234125;
b += 0.000051234125;
b += 0.000051234125;
b += 0.00... |
/**
*
*/
package steven.sth;
import java.util.HashMap;
import java.util.Map;
import android.location.Location;
import android.location.LocationManager;
/**
* @author steven.lam.t.f
*
*/
public class S20141201MockLocationTest{
private static final long MAXIMUM_GPS_INTERVAL = 10000;
private sta... |
/*
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by app... |
/**
*
*/
package steven.sth;
import java.util.ArrayList;
import java.util.List;
/**
* @author Steven
*
*/
public class S20141220Distance{
private static final List<double[]> list = new ArrayList<>();
public static final void main(final String[] args){
S20141220Distance.create(22.339617,114.2... |
/**
*
*/
package steven.ingress;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.uti... |
/**
*
*/
package steven.ingress;
import steven.graph.INode;
import steven.graph.Node;
import android.location.Location;
/**
* @author Steven
*
*/
public class LocationNode implements INode<LocationNode>{
private final String area;
private final String name;
private final double latitude;
pri... |
/*
* Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless requir... |
/*
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by app... |
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless requir... |
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless requir... |
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by app... |
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;
... |
import javax.swing.JOptionPane;
public class addeven {
public static void main(String[] args) {
String num1 = "";
}
} |
public class HelloWorld {
public static void main(String[] args)
{
int x;
x = 10;
x -= 2;
x += 2;
x *= 2;
x /= 2;
x = x%2;
System.out.println(x);
if(x==20){
System.out.println("it's 20");
}
else{
System.out.println("Its not 20");
}
}
}
|
public class main {
public static void main(String[] args) {
}
}
|
import javax.swing.*;
public class UserInput {
public static void main(String[] args) {
String num = "";
num = JOptionPane.showInputDialog(
null, "Please enter your name:");
if(num == null){
JOptionPane.showMessageDialog(null,"no name.");
}
else{
JOptionPane.showMessageDialog(null,"Hello"... |
import javax.swing.JOptionPane;
public class Calculator {
public static void main(String[] args) {
String num = "";
num = JOptionPane.showInputDialog(null, "Enter value:");
int b = Integer.parseInt(num);
if(b%2==0){
JOptionPane.showMessageDialog(null,"Even");
}
else{
... |
import javax.swing.*;
public class OddandEven
{
public static void main(String[] args)
{
int number;
number = Integer.parseInt(JOptionPane.showInputDialog( null, "Please Enter a number: " ));
if ( number % 2 == 1 )
{
JOpt... |
import javax.swing.*;
public class HelloWorld{
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 UserInput {
public static void main(String[] args){
String num = "";
num = JOptionPane.showInputDialog(null, "Please enter your name: ");
JOptionPane.showMessageDialog(null,"Hi "+num);
}
}
|
class LinkedListNode {
public int data;
public LinkedListNode link;
}
public class JavaApplication1 {
public static void main(String[] args) {
/*
exercise
head -> 45 -> 65 -> 50 -> 34 -> 76
exercise 1: insert 15 between 34 and 76
... |
import java.util.Random;
class sortArray
{
private int[] myArray;
public sortArray()
{
System.out.println("Default Order:");
Random digit = new Random();
myArray = new int [10];
for ( int counter = 0 ; counter < 10 ; counter++ )
{
myArray[counter] = 1 + digit.nextInt(10);
}
printEleme... |
class myArrayList {
private int[] myArray;
private int size;
public myArrayList( int value, int seed, int increment ) {
myArray = new int [value];
size = value;
for ( int counter = 0 ; counter < size ; counter++ ) {
... |
import java.util.Scanner;
class CalcLib {
int x;
int y;
public CalcLib( int num1, int num2 ) {
x = num1;
y = num2;
}
public int addNumber() {
return x + y;
}
public int subtractNumber() {
... |
package javaapp1;
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] =... |
package javaapp1;
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] =... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.