I am writing a program with different screens. At first you have to log in to access the program. So I have a problem with the variables username and password. I can't seem to get theme from the DbConnection class. I suppose it is a basic problem?
In the DbConnection class i have a problem with the returns.
In the Login class i have a problem with the connection.getUsername(); and connection.getPassword();
Here is some code:
class DbConnection package kim.contracts.database; import java.sql.*; public class DbConnection { private Connection conn; private Statement st; private ResultSet rs;
I have been working through a problem, and I have working what I need to work. However, it prints out to the command line and I want to output to a GUI. I have set up the GUI and everything seems fine there, the problem is when I try to change the output that was coming through the command prompt to a JTextField. I am getting the following error.
The field DataAnalyzerGUI.dataOutput is not visible
I have made a program on BlueJ but need to transfer the class to a pen drive so that I can take it to school and show it to my teacher. How is this done
I have a servlet that generate a list of objects named "Alerte". I display this list in my jsp and I want the user to be able to delete one of them by clicking on it. Data are stored on Google Datastore. My problem is that I don't know how to pass the current object from the loop of my JSP page to my java class.
try { is = new FileInputStream(file); data = new byte[(int) file.length()]; is.read(data); String extension = ""; int i = file.getName().lastIndexOf('.'); if(i>0)
[Code] ....
Everything works except transferring the image file.
I have a code which transfers images using rmi... This code works fine... But if i give a .avi file instead of a .jpeg the file gets transferred to the other machine but it gets corrupt... The size is also the same... Do I have to encode the video ??
I'm doing this project in JSP.net, with html. and in one of the web pages, what I'm doing is that, a person is transferring an amount to someone else, and if the transfer amount is more than the account balance, then he cannot transfer. else, save details in a table.
Here's the code I've used
<% String t1=request.getParameter("text1"); String t2=request.getParameter("text2"); java.util.Date date1 = new java.util.Date(); SimpleDateFormat ft = new SimpleDateFormat ("dd/MM/yyyy"); int tamt = Integer.parseInt(t2); int bamt = 0;
[Code] .....
But when i enter the fields and click the submit button in the form, to save it in the table, i get the error:
The idea I'd like to present, concerns the correction of "designer" drawings - those done by the design consultants - against "site/construction" drawings - them being used on site by the workers to build the project itself.
This is normally a laborious process, involving being sat at a desk with two large folders, checking each detail and measurement against the design drawing.What I'd like to present is an idea, where the co-ordinates of the design or "mother" drawing, are transferred into a usable Java program, and they could be then used to ensure correct dimensions have been applied by the the sub-contractors in their "construction" drawings.Like I said, this can normally be a process of days for a site engineer to check - process known as "QA, quality assurance".
Basically, I just need to make a presentation of having a genuine interest in Software Design and Development. It could be applied in a range of areas in terms of construction site application - checking drawings, writing up work orders, dig orders etc - but the principle of having the co-ordinates of the mother or "design" drawing scanned into an array in Java as a means to output those site drawings/orders etc, applies to each potential application.
So - in short - and not looking for crystal clear detail, just general pointers - what programs or methods could transfer a plethora of co-ordinates from a design program like Auto-Cad, to a Java program, where I assume I would then be using a program containing a complex series of loops to ensure the correctness of the derived "construction" drawings; derived from the "mother" or designer drawings, that is.
I'm doing an aggregation exercise that's suppose to find the volume and surface area of a cylinder. What I'm trying to do is pass values from one class, to a second class, and that second class passes values to a third class.
This may be a clearer explanation: The first class is the main program which sends values to the second and third class. The second class is used do calculations for a circle (a pre-existing class from another assignment). The third class grabs the values that the second class calculated and calculates those values with the one that was passed from the first class to the third class. The first class then prints the outcome.
Problem is when the program gets to the third class, it just calculates the value from the first class with the default constructor from the second class. It's like the second class never received the values from the first class. I think I'm missing a step, but I don't what it is.
First Class:
package circle; import java.util.Scanner; public class CylinderInput { static Scanner in = new Scanner(System.in); public static void main(String[] args) { //user defined variable
New to java/programming and i cant understand why the pen variable does not display the the correct value ... For example for input 1 ; 2 ; 3 ; 4 both variables will display 10 and i dont understand why pen does not have the value 6 .
import acm.program.*; public class Chap4_ex12 extends ConsoleProgram { public void run () { int pen = 0; int r = 1; int sum = 0; while (r !=SANTINEL) { r = readInt(" ? "); pen=sum ;
Variables defined in interface are public static and final so I was thinking that we should not be able to override the variables in a class thats implementing the interface. But when I am compiling the below class, it compiles fine and gives the correct values. but when I did disp.abhi = 35; it gives a compile error (cannot override final variable)
interface display{ int abhi = 10; void displayName();
This is my first time working with C++ and I have put together this program and came up with two errors and I am unsure what it is wanting me to do. The errors I got are:
1>c:usersownerdocumentsvisual studio 2010projectsweek5week5passing_by_value.cpp(30): error C2064: term does not evaluate to a function taking 1 arguments 1>c:usersownerdocumentsvisual studio 2010projectsweek5week5passing_by_value.cpp(38): error C2064: term does not evaluate to a function taking 1 arguments
#include<iostream> using std::cin; using std::cout; using std::endl; //initialize arrays int incr10(int* numa,int* numb);
I am new in this programming language, java. I have a problem after I set my path ";C:Program Files (x86)Javajdk1.7.0_51in". I made a simple program but an error occurred. Here's the screenshot.....
I continuously get an error for lines 34, 36, and 37 saying that the variables may not have been initialized.
import java.util.Scanner; import java.util.Random; public class MathTutor { public static void main(String[] args) { Random r = new Random (); Scanner input = new Scanner (System.in); /*int min=1; int max=10;*/ int num1,num2,operation; int n1= r.nextInt((9+1)+1); int n2= r.nextInt((9+1)+1); operation= r.nextInt(3); int correctAnswer; int userAnswer;
I'm quite new to Java. I have some trouble with understanding how to get two classes to get objects from each other (if that is the correct term).
Lets say I have a login class, in which I have a method checking what the user has entered into the console (I have not displayed the whole code, but this class works as it should and give the user an option to enter username and password and return it true if entered correct).
public static boolean validateUserPass(String userName, String password) { String[] user = {"admin"}; String[] passwords = {"firkanten"}; boolean check = false; for (int i = 0; i < user.length; i++) { if (userName.equals(user[i])) { if (password.equals(passwords[i])) { check = true;
Now, in another class I want a display box to appear on the screen and give the user three options: Click yes, no or cancel. I get this to run perfectly alone, this is not the hard part for me. I want the display box only to appear when the correct username and password is given, but I can't seem to figure out how to do this probably.
Regarding the code examples in Head First Java, this is from Chapter 5, regarding the beginning creation of the dot com game. There are two classes in quesiton
the first is the SimpleDotComTester class: public class SimpleDotComTester { public static void main(String[] args) { SimpleDotCom dot = new SimpleDotCom(); int[] locations = {2, 3, 4}; dot.setLocationCells(locations); String userGuess = "2"; String result = dot.checkYourself(userGuess); } }
and the second one is the code for the checkYourself () method in the SimpleDotCom class
public class SimpleDotCom { int[] locationCells; int numOfHits = 0;
public void setLocationCells(int[] locs)
[code]....
Now I noticed that both classes use a variable called result; the program runs fine, but assume from the example that you can use the same variable name two different classes;
design a class to conduct a survey of three hospitals. you want to know how many sectors (eg operation, children, gastronomic) each hospitals have, and how many doctors there are in each sector.
I have a Date class and Time class. Is it possible to pass Time object inside Date constructor so that toString function gives output as 12/05/2013 06:31:30 ?
In First class I want to use methods from Second class. So:
Java Code:
Second s = new Second(); s.secondMethod(); mh_sh_highlight_all('java');
Second thing I want to do is use JTextArea from First class in Second class.
So since it gives me error, I extended First class with Second:
Java Code: public class Second extends First { mh_sh_highlight_all('java');
It look like it should work, no errors etc. Also both things are working separately. But since I used both at once...
Java Code:
Exception in thread "AWT-EventQueue-0" java.lang.StackOverflowError at package.Second.<init>(Second.java:7) at package.First.<init>(First.java:17) mh_sh_highlight_all('java');
I can move what I need to First class, and it will work fine, but I want to make this in two classes. But I really don't understand extends, I just use them if there is need for them. So I don't know how to handle this problem.
I also tried to extends Second just like First:
Java Code: public class Second extends JPanel implements ActionListener { mh_sh_highlight_all('java');
Instead of extending First, but it can not be done, since ActionListener is in First...
Well. Also addActionListener can maybe solve my problem?