Basic Program To Plot Motion Of A Pendulum

Oct 22, 2014

Here is the outline of what the program should do: [URL] .....

So far I've got the very basics in place, I can't really figure out ptplot despite trying to research it online. The only other thing I know is that arrays are not to be used (initially I intended on using them). Here's my code:

//The next line imports the java.io package
import java.io.*;
//Imports math language
import java.lang.Math;
//import ptolemy.plot.*;
//Sets up class
public class cp5 {
//Declares class method called 'main'.

Code] ....

View Replies


ADVERTISEMENT

Basic Prime Factorization Program

Dec 10, 2014

What's wrong with the code.

public class alltheprime {
public static void main(int a) {
int i, j, k, l, m;
m=a;
k=0;
for(i=2;m>1;i++) {
for(l=2; l<i;) {
l=l+1;

[Code] ......

View Replies View Related

Basic Console Java Program - Generate Employee ID

Feb 27, 2014

Basic console java program. I need to generate an employee id. I have an employee class that I will paste here so you can see my fields and constructors.

public class Employee {
private String firstName;
private String lastName;
private int id;
public int nextUniqueId = 0;
public Scanner sc = new Scanner(System.in);

[Code] ....

View Replies View Related

Basic Stack Hanging - Program Kept Running With No Result

Nov 16, 2014

I was doing some exercises of a java tutorial website, and realized when I ran the code that they had , my program just kept running with no result, why is this? It just hangs.

package mystack;
public class MyStack {
private int maxSize;
private int[] stackArray;
private int top;
public MyStack(int s)

[Code] ....

View Replies View Related

Basic Grading Program - Output Should Be Printed With Suitable Labels

Oct 6, 2014

Write a program to request a student number and their marks in 4 subjects. The program must print the student number, total marks and average mark. All outputs should be printed with suitable labels

This is the error am getting

Scanner get = new Scanner (System.in) - got a red line

int student number, total marks, average mark - got a yellow bulb with a red exclamation mark on it.

I just dont understand where the errors is where what the system dont have ... I am using netbeans ....

View Replies View Related

Object Motion Detection

Mar 25, 2014

Any examples for object detection or motion detection program..

View Replies View Related

Java Motion Tracking

May 9, 2014

I want to learn more on motion tracking with java. Found some artikles and some examples with dead links. I haven't found much on it on google.I know it has to be done with JMF but besides that I cannot find any useful stuff on the internet.

View Replies View Related

How To Make Curve Motion With Ball Object

Jun 25, 2013

I want to make a simply game,actualy not a game but I want to moving object curve just like angry bird. Where I can move an object with curve motion. But I don't know how. I just can make it move straight(left,right,down,up).

View Replies View Related

How To Plot Graph

Nov 13, 2014

I am new to java. I wana create a java program that can plot a graph for that I've already written this:

/ x axis would be the ,,elemszam" from 0 to 599;
y axis would be ,,resz_xy"
double sum_xy=0;
double g=10000.0;
double z_xy;
double xy=0;

[Code]...

--- Update ---

Actually i'm using netbeans...

--- Update ---

and the datas are coming from a text file...

View Replies View Related

Plot Functions Using Abstract Methods

May 1, 2014

Assignment 13 – Plot functions using abstract methods (Plot functions using abstract methods) Write an abstract class that draws the diagram for a function. The class is defined as follows:

Java Code:

public abstract class AbstractDrawFunction extends JPanel {
/** Polygon to hold the points */
private Polygon p = new Polygon();
protected AbstractDrawFunction() {
drawFunction();

[code].....

For each function, create a class that extends the AbstractDrawFunction class and implement the f method. Figure below displays the drawing for the first three functions.how to make the jframe to work so that I displays the panel

Java Code:

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Graphics;
import java.awt.LayoutManager;
import java.awt.Polygon;

[code]....

View Replies View Related

How To Plot Geographic Coordinates In Java

Apr 3, 2014

-7984749.593824852,5368675.690126911 -7984392.035620423,5367570.791302501 -7983220.843257783,5366848.500158152 -7982343.534350842,5364796.5795687605 -7980293.251969412,5363408.488192292 -7980621.978425723,5361760.555707421 -7979175.604281852,5359233.088002191 -7977402.284793513,5358332.850725802 -7976513.843937492,5357665.108234091 -7976472.321767421,5357241.582554582 -7974834.812057852,5357842.933691362 -7973351.925120993,5354420.819505452 -7973743.435770122,5354147.992005592 -7973309.512395002,5352911.428583422 -7973639.9086436825,5352740.575552852 -7972698.034432082,5350359.050518452 -7972255.539456172,5350294.883494262 -7971909.001881332,5349519.720176511 -7970907.683061652,5349775.605440161 -7970575.617020612,5348986.585139751 -7970013.342272613,5349482.445545332 -7969898.683197102,5350177.703443532 -7968337.649977702,5350328.647515352 -7967111.243147633,5351652.264468962 -7966171.150047882,5351373.1018466605 -7966125.286417683,5352115.720678982 -7964626.258154663,5351707.120082232 -7955765.449326492,5345109.379313592 -7954159.443032822,5343966.704795052 -7942364.363746833,5335522.893249432 -7929990.868386692,5326092.063381992

View Replies View Related

Plot Functions Using Abstract Methods

Apr 29, 2014

Assignment 13 – Plot functions using abstract methods

Write an abstract class that draws the diagram for a function. The class is defined as follows:

public abstract class AbstractDrawFunction extends JPanel {
/** Polygon to hold the points */
private Polygon p = new Polygon();
protected AbstractDrawFunction() {
drawFunction();

[Code] ...

Test the class with the following functions:

a.f(x) = x2;
b.f(x) = sin(x);
c.f(x) = cos(x);
d.f(x) = tan(x);
e.f(x) = cos(x) + 5sin(x);
f.f(x) = 5cos(x) + sin(x);
g.f(x) = log(x) + x2;

For each function, create a class that extends the AbstractDrawFunction class and implement the f method. Figure below displays the drawing for the first three functions.

View Replies View Related

Two Threads - Generate Data And Plot It

Nov 17, 2014

I have two threads, one generates data based on some decision process (A) and another use the data to plot it (B). The problem occurs when there is no data to plot. What is the best way to synchronize these two threads? Using sleep, or wait/notify?

View Replies View Related

Creating Array And Putting Into Steam And Leaf Plot

Feb 12, 2015

I just want to know how I would go about creating an array of 100 random ints and putting it into a stem and leaf plot...

View Replies View Related

Read Positive Integer N And Plot 3 Triangles Of Size N

Oct 10, 2014

Write a Java program that reads positive integer n, 1 ≤ n ≤ 13, and plots 3 triangles of size n as shown below.

For n = 4, for instance, the program should plot: (works for n = 5 and n = 6 etc.)

triangle 1

1
2 3
4 5 6
7 8 9 10

triangle 2

_ _ _ 1
_ _ 3 2
_ 6 5 4
10 9 8 7

triangle 3

_ _ _ 1
_ _ 3 3 3
_ 5 5 5 5 5
7 7 7 7 7 7 7

import java.util.Scanner;
class Loops { 
void plotTriangle1(int n) {
int t = 1;
for (int i = 1; i <= n; i++) {
System.out.println(" ");
for (int j = 1; j <= i; j++) {
System.out.printf("%3d", t++);

[Code] ....

Currently compiles to this: Enter n(1-13):4
1
2 3
4 5 6
7 8 9 10

Format of the triangles, I couldn't get the spacing to work so I used underscores to replicate the blank space....

View Replies View Related

Basic Calculator Functions

Jul 2, 2014

my task is to add a few functions to an example calculator. I managed to add a divide button but I simply can't figure out how to add a working Pi and reciprocal function.

package newjavaproject;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class CalculateurNC extends Applet {

[code]....

View Replies View Related

Basic Cost Calculator

Oct 20, 2014

Why I am getting errors for this program I (tried) to write. I am new to java.

import java.util.Scanner;
public class TheBarkingLot {
public static void main(String args[]) {
int n;
Scanner input = new Scanner(System.in);
System.out.println("How many large dogs are boarding today?");

[Code] ....

View Replies View Related

Basic Grade Calculator

Jan 24, 2015

im considered quite the "javanoob" as my account name states..The assignment is to basically take a number that is entered by a user, and based off what they type in, display a corresponding grade letter. For example, if they enter a number between 90-100, they should receive a response that they received an "A". Now, this is fairly simple using an if/else statement, but my professor wanted us to implement this, using a switch case to teach us the difference.

import java.util.*;
public class SwitchTest
{
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);

System.out.println("Please enter a number to find out what letter grade you have recieved");

[code]...

View Replies View Related

Servlets :: Tomcat Basic Authentication

Mar 30, 2015

I moved some static html pages I was hosting from apache into tomcat. (no point in running two servers) This works as expected, but I'm having trouble with the authentication part. In apache the authentication was handled by htaccess. I tried various tutorials on the web about configuring basic authentication in tomcat using WEB-INF/web.xml in tomcat, but I'm not sure this approach applies to static html pages. Using basic authentication for static html in tomcat?

View Replies View Related

Basic Array Table Not Working?

May 9, 2015

My code is supposed to give the array index on the left and what is inside the array on the right, but i get nothing except the header? I am using eclipse.

public class Options{
public static void main(String args[]) {
System.out.println("Index Value");
int value[] = {1,2,3,4,5};
for(int add = 0 ; add <value.length ; add++) {
System.out.println(add + " " + value[add]);
}
}
}

View Replies View Related

Inputting Integers For Basic Commands

Jan 27, 2015

I am new to the java computer programming world. i am having basic trouble making the statement full and complete. i am trying to get it to say "The speed of the car is <answer> ft/sec" i have tried reading in the my programming book from school but it doesn't tell me how to fix it. the errors I am getting :

cannot find symbol

I have this error twice ....

View Replies View Related

Basic Time Translation Loop

Oct 25, 2014

I am new to programming so for loops are a little confusing to me still but basically what I am doing is making a small java rpg game and I want to add in a time element to it so your character gets things like promotions and such after a certain amount of time playing.

for (int x = months; x < 12; years++) {
for (int y = weeks; y < 4; months++) {
for (int z = days; z < 7; weeks++) {
for (int j = hours; j < 24; days++) {
for (int k = minutes; k < 60; hours++) {
}
}
}
}
}

That's what I have so far but I am getting a logical error/ infinite loop when I run. I have added each unit of time as a static variable so there's no problem there.

View Replies View Related

Basic Sprite Character Movement

Aug 18, 2014

how I would go about having a moving sprite on a page, such as a virtual pet kind of thing. I've tried searching for it through the years and I've tried it with what I know on my own, but things just act up every time. Either:

A.) The sprite moves (respondent to key strokes, of course), but leaves a trail of its image behind itself.

B.) The background image writes, but for some reason the second image does not write, or is lost behind the background.

I'm sure these are simple issues for most of you, but I've tried going about this for a while now with no luck. What I'm trying to do I'm trying to write a virtual pet game, and I would eventually love to make it move around randomly like an A.I. that's pathfinding, but I've got ideas about that, just I need to know how to make it move period first, everything else I think I could figure out on my own.

View Replies View Related

NotSerializableException With Basic DataSource In JNDI

May 29, 2014

I am setting up a standalone JNDI and loading a Datasource to the JNDI. DataSource I use is:

org.apache.commons.dbcp.BasicDataSource

The JNDI is set up as follows
 
String detectorHost = InetAddress.getLocalHost().getHostName(); 
System.out.println("detectorHost: " + detectorHost); 
System.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); 
final NamingBeanImpl namingInfo = new NamingBeanImpl();  namingInfo.start(); 

[Code] ....

I get the following exception

javax.naming.CommunicationException [Root exception is java.io.NotSerializableException: org.apache.commons.dbcp.BasicDataSource]  at org.jnp.interfaces.NamingContext.bind(NamingContext.java:677)  at org.jnp.interfaces.NamingContext.bind(NamingContext.java:611)  at javax.naming.InitialContext.bind(Unknown Source)  at com.lombardrisk.reform.integration.ReformIntegration.createJNDIServer(ReformIntegration.java:93) 

[Code] ....

I don't quite follow why I am getting a NotSerializableException exception, this is a local JNDI in the same JVM and not a remote JNDI. Not sure why this occurs.

View Replies View Related

Basic Java GUI Application - Array Searching

Nov 30, 2014

I am currently working on a application for a car park system. It uses GUI created by myself and holds 15 parking spaces. The user has the option to add, delete or search for a specific car. When the user adds a new car, details of the car are entered, the cars registration number (saved as a string), and the user had to check one raido button if the car is expensive, large or normal.

Once this information is entered a new instance of a vehicle will be created and the bay the car is allocated to turns green and stored in one of three arrays(expensive, normal or large). I also have a fourth array for creating the parking spaces.Each array can only hold 5 vehicles apart from the fourth which can hold all 15. When searching for a vehicle the user enters the registration of the vehicle they want to find, but I have to search through all three arrays to find it, and if it does not exist showing a message saying so.These are my three arrays

public static ParkingBay[] regularBays = new ParkingBay[5];
public static ParkingBay[] largeBays = new ParkingBay[5];
public static ParkingBay[] expensiveBays = new ParkingBay[5];

String Registration; - saves registration entered from add form
String RegistrationNumber; - saves registration number from search form

I need to search to see if RegistrationNumber is in either of the three arrays if not show a message saying otherwise

View Replies View Related

JSP Calculator - Performing Basic Operations On Numbers

Jul 8, 2014

I want a simple jsp page that performs basic operations on numbers such as addition, subtraction, multiplication, division and modulus . How to run that file?

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved