35,619 Topics
![]() | |
Hello! I'm doing a thing to where the java program will let the user input a length, and width of a triangle. In return it will show the length, width, and the area. I think I have everything correct here, however, the public voids I inserted does not work... Any … | |
I am new to sockets and trying to make a simple two person chat program and I have everything working except for the receiving and printing of the messages to the jtextarea. I am not sure why it isn't working here is my code: Driver: [CODE]import java.awt.*; import javax.swing.*; public … | |
Write a Java program that will generate random four letter words. The words must consist of only lower case letters. The program will prompt the user to enter the number of words to generate. The program should request that the user enter a number between 1 and 500 and ensure … | |
Write a function called Random that accepts two parameters of type double. The Random function will generate random numbers between a range defined by the parameters, The first parameter defines the lower limit and the second parameter defines the upper limit | |
Trying to figure out why code wont work. Its gets 2 errors for String newS1 = s1.sort; String newS2 = s2.sort; I dont know how know whats wrong [CODE]public class anagram { public static void main(String args[]) { java.util.Scanner input = new java.util.Scanner(System.in); System.out.print("Enter the first string: "); String first … | |
Please solve this java program Design a class EmployeeSalary to reflect the salary of an employee in an organization.All employee will be facilitated with common increment rate of their rank.Each employee's gross salary will be comprised of the basic ,house allowance ,medical allowance and transport allowance.The house ,medical,and transport allowances … | |
Account.java [CODE=java] package btclass; import java.util.Scanner; public class Account { private float amount;//actual amount private static float balance;//balance amout Scanner keyboard = new Scanner(System.in); public void deposit() { System.out.println("Enter the amount you want to deposit: "); float depos = keyboard.nextFloat(); if (depos < 0) { System.out.println("Amount you entered is < … | |
How do I exchange data from page to page? for example: on the 1st page I voted for 1 person, when I click submit it will go to the 2nd page that will let you see the output of the vote? I can't seem to do it, as I don't … | |
Hi .. Provably I'm setting this up the wrong way in Netbeans.. I open a new projetc and use the default main...then open a new empty java file and type my code , when I run this it runs fine but it doesn't ask for input ! [code]import java.io.*; public … | |
Hi i am having an issue using Math.pow its telling me that math.pow wants (double,double) and im giving it (double[] , double) is there away to use an exponent on an array package project2; public class project2 { public static void main(String[]args){ double x [] = { -2.0,-1.0,0,1.0,1.5,2.5,3.0,4.0,8.0,12.0,16.0,20.0,24.0}; double f=0 … | |
hi i m doing a project on ftp server..i need some basic codes to start with the program..i ve got few codes but it has some package,enumeration all such stuff which is complex..so i need a simple progrm...plz help me in getting it...... | |
I'm doing my bachelor of engineering in computer. I do not know whether to post this thread here or not. Sorry for my poor English. I have the knowledge of C/C++. Now i have started learning Java. Some of my friends says that C# is better than Java., is it … | |
Why i update one row of my data but end up it update all my data. For eg i update User : a to User: ab End with all User : ab | |
I am currently writing a program which will perform binary to decimal, decimal to binary, hexadecimal to decimal, decimal to hexadecimal conversions, 1's compliment, 2's compliment, and show the list of boolean algebra rules. I have created the JFrame and the JButtons to create the GUI however, I cannot figure … | |
Hi :) I was hoping someone could point me in the right direction to create a grid of clickable objects/images/shapes. My problem is this, I have to create a grid of 100+ characters that, when you click on one, appends a JTextArea with a specific, different, character. The only idea … | |
Hi everyone, Im new to site and new to Java - have an assignment in Hangman - to date I have created the Hangman class and coded the tester so its working with 1 word! I have also coded the hangman component which is currently static and displayed on opening … | |
I have a question on how to get the index of a selected object. I'll briefly explain my project to help get a better understand of what I'm doing. I have created a simple object (named InfoObject) which is made up of 2 jTextfields and 1 jComboBox. I have added … | |
Stupid question, I'm sure: For an assignment I need to create a program that uses methods and constructors in several other classes... the classes were in a file that I unpacked and put in the same directory as the one I'm writing is in. What do I need to do … | |
Considering no one seems to be-able to answer my other thread I'll try simplifying this one. I have created GUI frame which contains a menubar at the top. I have several methods as well as a method which paints 5 circles onto the frame. When I call that method, by … | |
Here is my code to write the arraylist to .dat file, And im not sure if its working but it writes to the file and i can see all the random characters so it is writing something but i keep getting io errors when i try to use the method. … | |
import java.util.*; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.io.*; // user defined type where we put name class riot2{ private String name; public riot2(String _name){ name = _name; } public String toString(){ return name; } } public class finalriot2 extends JFrame{ Container c = getContentPane(); private Stack sstack; // … | |
Hello, I'm working on a little project. I need to have program which: [B]1.[/B] reads textline from user (example: A little cat goes to town) [B]2.[/B] a) reads words what user wants to change to 0 (example word cat to 000) b) one word to one line and if given … | |
help how to make payroll using java program and the following conditions: 1.one dimensional array 2.two dimensional array 3. accept inputs of string, integer and double data types 4. validation using if-else-if 5. use of loops constructs 6. computation 7. summary 8. use of JOptionpane/system.out.print pleas help me | |
hi, I am developing one application for upload and download the files using applet and servlet. My problem is, when i upload the files from client to server is working. but when i download the uploaded file from server to client, o byte only download.. once refresh the server, file … | |
Help ! I am new to jsp. I am writing the part of my code. It has 4 textbox fields - Name, Module, Module, Contact no. In my code 4 rows are created each having the 4 fields. What I want is that after user comes to the 2nd row, … | |
Dear all, i'm facing a prob for past few days that my servlets classes are not referenced properly in glass fish server . i downloaded a project from sourceforge.net named Javalibrary [url]http://sourceforge.net/projects/javalibrary/[/url] i imported all the files and all files working properly in netbeans i mean i can run the … | |
I should create a Java program called FindThatNumber.java. The program should generate 10 random integers between 1 and 100 (inclusive) using Math.pow( ) and then store them sequentially in an array. The program should then ask the user to enter a single integer. If the integer is in the array … | |
I need some help with understanding an error that I am getting. Can anyone help me. Here is my problem. I am trying to hardcode information for a mortgage calc and I am getting an illegal start of expression error. Here is an example: MortgageLoanCalculator.java:15: illegal start of expression double … | |
Write a method that computes future investment value at a given interest rate for a specified number of years. Use the following method header: public static double futureInvestmentValue(double investmentAmount, double monthlyInterestRate, int years) For example, futureInvestmentValue(10000, 0.05/12,5) returns 12833.590. Write a test program that prompts the user to enter the … | |
String class provides us with the method String.valueOf(some stuff) that basically converts "some stuff" into a string.. But we can also concatenate "some stuff" with an empty String (""). Both these methods result in a String representation of an object(or other data type) so my question is what is the … | |
The application will ask questions like: What comes after D? A child is expected to answer the question and the application will inform the child if the answer is correct or wrong. The application will ask a total of 20 questions. After all 20 questions have been answered, the application … | |
I have no idea whats wrong here, i am fairly new to java.. heres my code.... [CODE] private JPanel pnlLogin, pnlFinalLogin,pnlUser, pnlPass = new JPanel(new BorderLayout()); btnLogin = new JButton("Login"); lblUser = new JLabel("Username:"); lblPass = new JLabel("Password:"); pnlUser.add(lblUser, BorderLayout.WEST); //pnlUser.add(txtUser); pnlPass.add(lblPass, BorderLayout.WEST); //pnlPass.add(txtPass); pnlLogin.add(pnlUser, BorderLayout.WEST); pnlLogin.add(pnlPass, BorderLayout.CENTER); pnlLogin.add(btnLogin, BorderLayout.EAST); … | |
I have an eclipse application from which i trigger an Swing widget.On click of a button on the SWT composite a window pops out which contains the Swing Table. Now i want a button on this Swing page to show up an eclipse workbench window. Any idea on how I … | |
When I try to run my WordSort class with another class using the code: WordSort ws = new WordSort(sentence); ws.sort(); The program prints out what I want it to in the first method but for the ws.sort() method, the program prints out null. I would like it to print out … | |
I'm making a game as my project in school. I'm having a problem regarding double buffering, im trying to draw an image (drawImage(,,,,)) into the double buffered image, I can't seem to make it work help please =D [CODE] public void render() { if(doubleBufferImage==null){ doubleBufferImage = createImage(PANEL_WIDTH,PANEL_HEIGHT); // Set Size … | |
hi, here is my code having return method that working correctly when i print it from inside of the method, but if i call from main method its shows only one output instead all results.. [CODE]public class SearchCompare{ .... public String process(){ String showResult=null; ... .. for (String found: names.keySet()) … | |
please tell me where i'm off the window opens but no menu bar. the error says : java:52: '.class' expected menuInput[][] = array [row][col]; thanks hs [CODE] import java.awt.*; import java.awt.event.KeyEvent; import javax.swing.*; public class Driver{ public static void main(String[] args) { TheWindowObject aTestFrame = new TheWindowObject ("test"); } } … | |
hey guys, i have to do this program and i'm having trouble: Write a program that lets the user enter the loan amount and loan period in number of years and displays the monthly and total payments for each interest rate starting from 5% to 8%, with an increment of … | |
delete this, solved, had to do with how a variable was declared | |
I just wrote my first program using methods (I am only on chapter 5). I am not sure where I would use javadocs other than the ones that I already have in my code. Can someone help me? [code]/** * @author Brock Shelton * Date: March 15, 2010 * purpose: … | |
Hi all, I have been trying to find this out for 4 days straight, doing all types of research and yet I cannot find it, although it seems like one of the most fundamental things I can think of. I am new to jsps and servlets but not new to … | |
Hello everyone :) My problem is that my input will not be transfered when i build a new Object. To understand my problem i give you first the output: Welcome Hero! Show me your Attributes! Enter your Name: KIKI Enter your Strength: 50 Enter your Health: 60 Enter your Intelligence: … | |
import java.awt.*; import java.awt.event.*; import java.io.*; public class StudentWriteApp extends Frame implements ActionListener { //Declare stream objects FileOutputStream outputStudent; //Stream to create file ObjectOutputStream objSaveStudent; //Stream to save an object //Declare components TextField txtStudentName = new TextField(20); TextField txtAddress = new TextField(20); TextField txtResults = new TextField(25); Button btnSave = … | |
Hi , I'm a new learner of Java I start study Java since 2 weeks one of my friends challenge me to type program that show the number which I enter , It's even or odd . could you help me about the main things ,,, | |
just needed to know when does getHeaderField(String) shows null. Is there any other case where null is returned even if the header exists | |
Hello everyone, My aim is to include content dynamically in JSP but I have no means to tests and I don't know JSP. My code is already working in PHP and I would simply need some help to convert it to JSP... My PHP code is : [CODE] echo file_get_contents("http://www.myserver.com/newsletter/?action=detailnewsextern&profil=CocaCola&extern=1&inter_lang=fr&limit=3&".$_SERVER["QUERY_STRING"]); … | |
All, Basically what you have here is a PART of my program. Here I am supposed to get the LENGTH of a rectangle from a user and return that length to the main method for further use. My program works fine if I take out the input validation but I … | |
[code]<% String user=request.getParameter("LedgerName"); ResultSet rs=st.executeQuery("SELECT RoomMasterID,RoomNo FROM RoomMaster AS RM, LedgerMaster AS LM WHERE RM.LedgerID = LM.LedgerID AND LedgerName = '" & Me.datRoomType.SelectedItem.Text & "' AND RM.Status <> 'NO' AND RoomMasterID NOT IN (SELECT DISTINCT RoomMasterID FROM BookingMaster WHERE ' " & Me.datarrivaldate.AmericanDate & " 'BETWEEN FromDate AND ToDate) AND … | |
Hi everyone , I have huge problem I developed a jsp project which work great on tomcat on windows through eclipse but when I run it on linux tomcat I get error symbol can not be found that means the compiler does not recognize my class when I use it … | |
how to create a new excel file on click of a button in java? |
The End.