I like to know how to write root function in java applet. I know it in java function. Ex:
import java.lang.*;
public class Maths {
public static void main(String[] args) {
// get two double numbers numbers
double x = 9;
double y = 25;
// print the square root of these doubles
System.out.println("Math.sqrt(" + x + ")=" + Math.sqrt(x));
System.out.println("Math.sqrt(" + y + ")=" + Math.sqrt(y));
}
}
working fine. but If I tried in applet it's not working. Ex:
I need to convert c# function to java method. The important thing is String strKey. Parameters for testing are strMask= 4634958 and strSN=1394901184 and the result must be strKey = 2156325482!!! The result that I am getting with my Java code is 2138641814.This is C# code:
There is an error in my code that pops when I tried to execute my java application for an exponent function that I wrote. Here is my code and here is the error is generated when I run my code:
//a java application that calculates the power of an integer in a method that the user creates //and uses a while loop to do so. User cannot use any Math class methods to perform this calculation
import java.util.Scanner; public class exponentiation{ //main method begins execution of java application public static void main(String[] args){
[code]....
Why is it an illegal start of an expression? I didn't think you needed to used if statements for a whileloop.
I'm using jdk7 and I get this error when I compile Exception in thread "main" java.lang.Error: Unresolved compilation problem: at First.main(First.java:16)
I am making a pizza program and most of the program works. I have made an order button that will output the total price of the order. The reset button that I made makes the JTextArea output $0.00, but if I press the order button to make another order, the program does not add the new amount to zero. For example, if I make an order that totals $5.00, but I want to make another order after resetting, the price for the new order will be added on to the previous order's price.
Here is the code. This is a JApplet program. Why the price will not reset? This code was made in BlueJ.
//Author:Kishan Patel // Sources will be cited soon. //This is Lab 7, the pizza parlour program. import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.io.*; import java.util.*;
i need a java library function that searches the stream of tcp packets coming to my computer from a particular ip address, so i can perform regular expressions on the contents of those packets.
And this works fine: URL....The war file is deployed under the context root /bankconnect/ I want to make a servlet mapping, before the context root "i still want the context root bankconnect". URL....
For a project I have to create an online survey, I cannot use a per-made online survey system because I have really specific needs that no pre-made system can satisfy, so my idea would be to create it in java and store the data in some simple text file, which are fairly easy to work with in java. My question is, is it possible, and if yes how difficult is it, to put the entire thing online? What worries me isn't putting the applet itself online, but the text files that should collect the data, I already have the website to host it.
I am trying to pass parameters from he following HTML file to an applet. the applet is not initializing and the iam getting the following error on the console. I also have both the html file and and the java applet under the same source file in eclipse.
java.lang.NumberFormatException: null at java.lang.Integer.parseInt(Integer.java:542) at java.lang.Integer.parseInt(Integer.java:615) at applet.DisplayMessage.init(DisplayMessage.java:16) at sun.applet.AppletPanel.run(AppletPanel.java:434) at java.lang.Thread.run(Thread.java:745)
Here is the html file
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Insert title here</title>
I have an applet coded to recieve an image and upon mouse press i wish it to be cropped. For some reason its not implementing, I just think my brain is no longer doing what i think it should be or something, along those lines.
I am trying to go about making this applet a bit different then normal. The issue I am having is it is drawing an applet but, not the right dimensions, it's able to be resized, lastly the background color is not being set. I mean, I suppose I could call paint() and just draw it out but, I read that I could make the applet pop out to the dimensions I would like. None of this is working sadly.
So I have a program for a project that permutes a random series of numbers using Java's Rand function. Basically I use a seed and a number of items I want in the arrangement of numbers, and the program makes a permutation with no two numbers being repeated. Only arrays can be applied to it, so I've been hard at work finding a solution.
Here's the code so far:
public static int permutation[]; public static void permute(int numOfItems, int seed){ permutation=new int[numItems]; Random rand = new Random(seed); permutation[0]=rand.nextInt(numItems-1);
[Code] ......
So basically I'm wanting the program to make a randomized list of numbers from the number of items I pass to the Permute method with no duplicates. I'm having some level of success with what I have written, as it gives me a randomized list when printing the output, but for some reason the first for statement in code never terminates fully, but instead runs indefinitely when generating the last integer.
For example, if I want to put 10 with a seed of 0 into it and make a list from 0-9, it will print 74283510, which is only 8 different integers. permutation[0] is manually set at the beginning of the method, which accounts for one more, but that's still only a list of 9, so I'm just wondering why the last integer is not being generated and why the program keeps looping and not terminating? I'm know for sure it's something I'm overlooking.
I have An Issue With My Java Applet. Im Trying To Share My Variables With Another Class, But Its Not Working.
Class 1
package com.Tobysmith10.game.main; import java.applet.Applet; import java.awt.Graphics; public class Game extends Applet{ public void init(){ setSize(850,480); public void paint(Graphics g){ g.fillOval(x,y,20,20); } }
Class 2
package com.Tobysmith10.game.main; import java.applet.Applet; public class gameLoop extends Applet implements Runnable{ public int x, y; public void run(){ while(true){ x = 100; y = 100; } } }
So im sharing the x and y variables with the Class 1 , but I get yellow lines under it and when i run the program, it crashes, how do I get class 1 to recognize the variables from class 2 ?
Working on an assignment for a class: Create a DESKTOP application that allows you to open an image file and enables you to zoom in on or out from an image. I believe all I need is too create an open button to open the actual image file, instead of the html link, this code is an example that the teacher provided.My current code:
I've been using a Java applet for sports tables.It has been very useful for me. However, the recent developments from the people at Oracle have made this program impossible to use. The point is that I need this program and I need it fast.I've been in touch with the person who once created this applet and he has no intentions at all to upgrade it or do anything to make it function. How to make the program works with their new updates.
My company is a transport company. We receive goods form partner and transport it to customers. There is a process that we must accept a number of kilograms into bill after we weigh goods by the electronic balance(the electronic balance have serial port plug in PC) . To decrease this process, I'm looking for a project "read serial port wrote in java applet". Who have code,
I have deduct a number of days excluding holiday and weekends .So if I have to deduct 4 days from current day (02/12) and assuming 02/10 is a holiday my answer will be 02/05
Now below is the code I have come up with however its not working with the hardcoded dates I am passing in to the Holiday Calendar String .Only the last value is considered . How I should store this values and compare with the date
package date_calculation;
/** * Returns a tick for each of * the dates as represented by the <code>dtConstants</code> or the list of <code>dtDateTimes</code> * occurring in the period as represented by begin -> end. *