Applets :: Subtraction And Multiplication With One Click?
Mar 21, 2014This is what I ended up with and it is not what I want.
How do I convert this to an applet that would run independently on a desk top out of all these shells?
[URL]
This is what I ended up with and it is not what I want.
How do I convert this to an applet that would run independently on a desk top out of all these shells?
[URL]
I am trying to build a servlet that does simple addition and subtraction then re displays the result on the same screen. I started the building the servlet I am just not sure I understand how to assign the value from a text area to a variable, so that I can complete the logic its still early stages, but its a simple app so it wont be a very long project(I hope lol). My question is how to assign the value that the user inputs to the text area to a variable that I can use?
My code and compile time errors:
C:UsersReignDesktopHTMLBank.java:89: cannot find symbol
symbol : variable Amount
location: class HTMLBank
if(Amount.equals("")||Amount.equals(null))//||Amount.equals(<0))
[Code].....
I'm new to Java. I have a problem with this code, wherein you have to count how many times you borrow in order to do subtraction.
For example:
x = 312;
y = 34;
The output should be: 2 because you have borrowed 2 times in subtraction.
My problem is like this, whenever I input x=12, y=2, the output is 1, also, when x = 12, y = 1. It should be 0.
Here's my code:
import java.util.Scanner;
public class BorrowOut{
public static void main (String [] args){
Scanner in = new Scanner (System.in);
int x;
int y;
int i = 0;
int j = 0;
[Code] ....
I need creating a code that will create random addition or subtraction from 0-500 depending on their grade level. I know how to create a random for the math and subtraction. I just dont know how to get it to change depending on their grade level. Example I need it to ask their name, grade level, addition or subtraction then five addition or subtraction questions depending on what they chose.
View Replies View RelatedI am new to applets, and my manifest file is:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.3
Permissions: all-permissions
Created-By: 1.6.0-internal (Sun Microsystems Inc.)
Name: com/myPackage/test/client/TaskApplet.class
SHA1-Digest: pLmraui35IkgfAq+v3WGj1LwCYQ=
The error I get is as follows...When the page is loaded I get the following error: java.lang.SecurityException: class "com.myPackage. test.client. TaskApplet" does not match trust level of other classes in the same package
so for my computer science class, we have the following problem:
In your documentation be sure to say which loop you thought was easier to implement for this program and why Write a program that produces the following outputs. The first line of output must be written using a For-Loop. The second, using a While-Loop and the third using a Do-Loop.
You look at the program and smile because you see that the series is just the numbers 1-10 squared...just one line is in reverse order. No problem! As you start typing you discover that the number 8 key on your keyboard is not working. For this program you are unable to use the multiplication key
So, back to the drawing board. By staring at the sequence a light comes on and you are able to quickly finish this program WITHOUT using mulitiplication (or the Math class/ solve with arithmetic operators +, - or / ) .
Sample output:
For Loop
1 4 9 16 25 36 49 64 81 100
While Loop
100 81 64 49 36 25 16 9 4 1
Do While Loop
1 4 9 16 25 36 49 64 81 100
I have the "for" done, but I did it with a "for" in the beginning but then had a multitude of nested "if" loops so that I could do 7*7=7+7+7+7+7+7+7
I am having problems with my code I have added the multiplication and division but they will not display also how can I correct any error when dividing by zero?
import java.awt.*;
import java.awt.event.*;
public class calculator2 extends java.applet.Applet implements ActionListener {
TextField txtTotal = new TextField("");
Button button[] = new Button[10];
[Code] .....
Code for sparse matrix addition and Multiplication...
View Replies View RelatedI am making rows and columns in the form of a multiplication table, listed below is my code:
package assignments;
public class MultTable {
public static void main (String [] args) {
int row, column, x, y;
for(row = 0; row < 8; row++)
[Code] .....
If you see my sample run you can see that I have the multiplication table down but, I haven't completed it. I have to make the bottom left half of the whole table blank somehow. For example, I have to make it halfway through the middle of the table the bottom left half full of white space...
5 6 7 8 9
12 14 16 18
21 24 27
32 36
90
hm, it's supposed to be the other way around horizontally.
noticed that if I use integers only and simple multiiplication to get my exponent results (in this instance I was looking into Base 26) what is returned is odd, BUT consistent results once I surpass the integer upper limit of 2,147,483,647. I anticipated that once this limit was reached the program would blow up somehow, but no.
public static void main(String[] args) throws IOException{
// TODO Auto-generated method stub
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter an integer exponent: ");
int i = Integer.parseInt(br.readLine());
CountAlpha ca = new CountAlpha();
[code]....
I was trying to execute the following program and the multiplication worked but the division didn't work.
import java.util.Scanner;
public class BodyMassIndex {
public static void main(String[] args) {
// Prompt the user for weight and height
// Create a scanner
Scanner input = new Scanner (System.in);
System.out.println("Please enter your weight in pounds");
int weight = input.nextInt();
System.out.println("Please enter your height in inches");
int height = input.nextInt ();
double BMI = weight * (0.45359237)/ (height * 0.0254)*(height * 0.0254);
// the weight * (0.45359237) executed but it wasn't divided by (height * 0.0254)*(height * 0.0254)
System.out.println ("Your BMI is "+BMI);
Design and implement an application that produces a multiplication table, showing the results of multiplying the integers 1 through 12 by themselves
View Replies View RelatedSteps are:
Create a new class, MultiplicationTable, that has a single field to store an integer multiplication table
Create a constructor that takes a parameter for the maximum number to be multiplied in the table. For example, MultiplicationTable(9) would have a maximum value of 81, where as MultiplicationTable(12) would have a maximum value of 144. Initialize the field in the constructor with the appropriate multiplication values.
Create a multiply method that takes two integers as parameters and returns their multiplication value by looking it up in the field. Make sure to test this method with values greater than the max the table should have stored. How can you handle these cases?
Create a main method that repeatedly tests multiply by printing out the entire multiplication table.
So far i got:
Java Code:
package collectionsHw_netid;
class MultiplicationTable {
// field
int mt;
MultiplicationTable(){
{
for (int i=0; i<=9; i++)
[Code] ....
Is my code right? also how do i print it out? the professor told us that everything should be outside of the main method...
I have a basic html form with one user input text box labeled "Enter a number" and a submit button labeled "Create a multiplication table". This is the working with a servlet to display an html formatted multiplication table. Everything else is working fine just the formatting is off; I can't seem to get the top row and far left column to number properly. It should look like this with the top row of numbers beginning with a blank cell and then numbering 1 thru n (depending on what the user selects. The first column should be the same, a blank cell and then 1 thru n. Then the multiplication table should be in the rows/columns of the table. Picture this:
I can't get mine to start with a blank cell in the top left-hand corner, instead it has 1 in that cell and the table starts calculating with 2x2.
Servlet code:
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
[Code] ....
How can I do a subtraction quiz program using input dialog quiz?
View Replies View RelatedWrite a program that prompts the user for an input number and checks to see if that input number is greater than zero. If the input number is greater than 0, the program does a multiplication of all the numbers up to the input number starting with the input number. For example if the user inputs the number 9, then the program displays the following sum:
9 * 8 * 7 * 6 * 5 * 4 * 3 * 2 * 1 = 362880
That's the question I'm getting and so far all I've got is
import java.util.Scanner;
public class Lab4Q3
{
public static void main (String[] args)
{
int keyboard;
[Code] .....
this is what I clobbered together for the O'Reilly Java 2 Course, final assignment. There may well be several issues still with this code, my main grief at the moment is: The mouseReleased does not react (it did in the assignment I lifted it from and made only minor changes). No matter where I click on the grid, nothing happens.
import java.awt.event.MouseAdapter;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.MouseEvent;
import java.awt.Container;
[code]....
I do not think this is possible, but I'd like to confirm. If I have an HTML page that has an embedded Java applet, and that applet in turn renders an HTML document (within the applet window), is the HTML *within* the applet part of / accessible through the DOM for the parent page?
View Replies View RelatedWe are using an applet in our web application. The applet of our application is dependent on bouncycastle jar,bcprov-jdk15.jar and few other jar's whose size comes around 4 mb. When using the appliaction on jre7, the applet is taking too long time to load than usual time. Is there any way to place these jar's in client machine? Will it improve the performance? Is there any other way to reduce the loading time of applet apart from placing jars in client machine?
View Replies View RelatedI have a simple applet that doesn't stray outside the sandbox. It used to work fine before Java 7 but now it craps out with security warnings. It does nothing but play a game, it doesn't even save the state of the game. This is the applet, it's a very simple chess program.
The warnings and popups I'm getting are:
activate javaTM platform SE 7U?allow now?activation blocked by security settings - I never changed any security settings and as I said, this applet stays firmly in the sandbox so I can't see what the issue is.Viewing the java error window I see
Java Plug-in 10.51.2.13
Using JRE version 1.7.0_51-b13 Java HotSpot(TM) Client VM
User home directory = C:UsersMike
----------------------------------------------------
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
o: trigger logging
[code]....
why it shows the C:UsersMike directory in the above listing, there is no access to files etc.The applet plays fine if I run it in appletviewer.What do I need to do to make this simply work in anyone's browser? I have a similar problem with a (rather funky) Connect 4 program I wrote. It worked fine for years and then just stopped with the Java 7.
I'm developing an Applet that print a bar code using Jpos API. I need some jars and two configuration file. I've added jars to the classpath and configuration files in src directory. In Eclipse everything works fine.
DefaultProperties prop = new DefaultProperties();
prop.loadJposProperties();
SimpleXmlRegPopulator xmlReg = new SimpleXmlRegPopulator();
xmlReg.load(wincor.jpos17.THxxx.xml");
Everything works fine in Eclispe but I can't find property files when i call the applet from a web page. So I've checked the JavaPos sources and I've paste the loadJposProperties() and xmlReg.load("wincor.jpos17.THxxx.xml") content in my source code:
InputStream isD = prop.getClass().getClassLoader().getResourceAsStream(prop.JPOS_PROPERTIES_FILENAME); // (1) content of loadProperties
if (isD != null){
System.out.println("jpos/res/jpos.properties found");
[Code] ...
The same method is used to found wincor.jpos17.THxxx.xml. So when I call applet form the browser I get INPUT STREAM FROM PROPERTIES OK!! from (1) and jpos/res/jpos.properties not found from (2).
So getClass().getClassLoader().getResourceAsStream works if i write it directly in my code, but doesn't work if i call a jar method.
I am currently trying to update a few java applets for a website. As of right now, the applets are automatically blocked on all computers when they are accessed because the newest updates for Java have caused them to be blocked. I have determined that the solution to this is to resign the .jar files that are used to run the application with a new certificate.
I requested and received a certificate (in pkcs 12 format, a .p12 file), imported it into the computer, and used it to sign the .jar files. However, I have been getting an error after signing the .jar files stating that the full certificate chain of the code signing certificate is not valid.
I tried to check the path of the certificate using a method he recommended (using OpenSSL) but didn't really find anything of use.
I'm trying to learn how to Pause/Resume audio in an applet .
View Replies View RelatedSo I have an applet and in the first ScrollPane you have a number of options of businesses
The Centre
IMAX
etc ..
and when you click one , the other scrollpane shows office
so when i choose "The Centre" for example , in the right scrollpane it shows : "Head Str." "Downtown" etc
i can fill in the first scrollpane with:
void myInit() {
DefaultListModel model = (DefaultListModel)businessList.getModel();
model.removeAllElements();
try {
ArrayList<Business> bussinesses = contr.getBusiness();
[code]....
but this gives me a NullPointerException on
ArrayList<Office> offices= business.getOffices(name);
which i don't understand, since business isn't null .. it's the selected value.
I bought a certificate to sign my jars, if a deploy my applet in a html file with out framework, just html and js, the works great, I can call from javascript all public methods from the applet. The real problem is when I try to deploy the same signed jar on a adf project in Jdeveloper. Does not work at all and java execute some warnings and later applet is block, the message say something like "exist some jars signed and not signed" But I am sure that all jars are signed...
I got this:
applet console:
image
All jars are signed, dependencies too.
I have an applet and start some process on Windows from applet. When I start this process just from another code(test), this code works fine and process runs from rt.exec() to proc.destroy(). When I use html call for applet - process runs only for 5 seconds every time (!!!) and then just alive, doesn't work, to proc.destroy(). This is really interesting for me (newbie in applets). I think, this issue caused by AccessController. I use Windows, medium Java security lever and applet is self-signed. It asks me to 'allow', applet works.Here's the code:
public String startRecording(final String filename) throws IOException {
try {
return (String) AccessController
.doPrivileged(new PrivilegedAction<String>() {
public String run() {
try {
proc = Runtime
.getRuntime()
[code]....
It's FFMPEG process, which records desktop video and writes it to file, maybe AccessController blocks access to file system.