32,199 Topics
| |
/*I am trying to generate 6 random unique (1-49) no.s and understand that my validation is incorrect.Help Please?*/ [code] import java.util.*; import javax.swing.JOptionPane; public class ranUnique { public static void main(String[] args) { String output=""; int[] arrayRan=new int[6];int ran2; for(int ran=0;ran<arrayRan.length;ran++){ arrayRan[ran]=(int)(Math.random()*50 //validate for(ran2=0;ran2<=ran;ran2++){ if ((arrayRan[ran]==arrayRan[ran2]) || (arrayRan[ran]==0)) { arrayRan[ran]=(int)(Math.random()... … | |
hi guys, am stil new to java their was a snippest code about getting screen size i've being seeing onine calling window.getSize() in what package is the object located. // Get the size of the screen Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); // Determine the new location of the window int w … | |
Derive an algorithm which updates the ith elements from the top of the stack, upgrade this algorithm to calculate the maximum value among the contents of the task. Hence write a java program to implement this task | |
Hi everyone,can anyone explain to me how to develop the Sokoban game in Java?Like a step by Step,am a newbie | |
HI, could someone explain me this line of code: public void createTextFile(Layer layer, String prcString, String arString) { File fileStatPercent = new File(fileName+layer.getName() + "Test.txt"); try { BufferedWriter out = new BufferedWriter(new FileWriter(fileName + layer.getName() + "Test.txt")); out.write("something"); out.newLine(); out.write(prctString); out.newLine(); out.write("something"); out.newLine(); out.write(arString); out.write("\n"); out.close(); Thank you, i don't … | |
Hi! I'm a 2nd Year IT Student and right now I have a problem in creating an Address Book Program using Java Codes.. It has never been discussed to us in class so i really don't know how to do it but look for it online.. I have used Mr./Ms. … | |
Hi all, I have a program that I have to write with an output that looks like this: ---------------------------------------------------------- Wages for 3 employees For 10 hours worked, the wages are 120 dollars For 20 hours worked, the wages are 240 dollars For 30 hours worked, the wages are 360 dollars … | |
i need help wit the source code for sokobane game ,starting from the main program | |
I need to design an application that reads a string from the user, then determines and prints how many of each lowercase vowel appear in the entire string. Separate counter for each vowel. I also need to count and print the number of consonants, spaces, and punctuation marks. The problem … | |
Need help writing code for generating random triangles. You will have the following functions (no violation of these interfaces) and you may have others, as needed: − public static void GenerateRandomTriangles(int numTriangles) to create a file RandomTriangles.dat having the following format (including some comments like the ones shown below) with … | |
consider public class awah{ private int x=0; private int y; private int w; public awah(int width){ w=width; } public void sety(){ y=(Int)(Math.random()*4);}//meth1 public int gety(){ return y; } public void setx (){ x+=this.gety(); } public int getx(){ return x; } public void showUpdate(){ System.out.println(x); } }//end of awah public static … | |
I need to design and implement an application that produces a multiplication table, showing the results of import java.util.*; import java.text.*; public class MultTab7 { //---------------------------------------------------------------------------------------------- // Creates a multiplication table. //---------------------------------------------------------------------------------------------- public static void main (String[] args) { int MAX = 12; for (int r=1; r<=MAX; r++) { for … | |
Hello guys. I need to write a client-server app that provides a simple Lotto server and client to generate a user-defined sequence of random numbers in the range 1 - 42. The system operates as follows: 1) Client sends a string message to the server indicating the operation to be … | |
I am currently trying to establish SSL connectivity using eToken via PKCS11. The PKCS11 provider is setup and I can read the 3 stored certificates as a key Store Object. But I am getting the following exception while trying to establish SSL connectivity. I am using JDK 6.0(java version "1.6.0_31-rev). … | |
i made this code to loop number for(int i=0;i<4;i++){ double temp[i]=Math.random() * i*10; system.out.println("Result" +i+ "=>" +temp); } output : Result 0 => 14.3 Result 1 => 11.4 Result 2 => 10.8 Result 3 => 12.4 now, i want to sort by ascending this output based on value with keep … | |
I need to get specific objects deleted from a LinkList, but the deleted items come from a stack of sorted State objects, but the Statename is the only value. I am trying to compare the statenames when using deleteKey, but for some reason it is not working at all. I … | |
Hi all, I need help in writing a method that calculates & returns a person's age (in years)given instance variables day, month & year all of type integer(int). | |
Hi, I have a desktop app in Swing. Now i want a javascript function like mailto when I click a JButton. Please help or provide any suggestion on my approach. Thanks in Advance. :) | |
I am able to insert the document with attachments in it as blob into Oracle DB. I am able to download the same document with the same attachments. But When I open it(blob) with Document Builder and write some lines of text in it and convert back to Blob and … | |
I am trying to write a Java program to download youtube videos. When I search in internet I found that most of the codes use to get the index of "url_encoded_fmt_stream_map=" from the YouTube page source. I think this is to extract the exact video format link. But I am … | |
## Sub-Heading Here ## hello guys, am new here and am looking forwad to getting a lot of help and helping others as well. I have an assignment that requires a program that outputs the numbers 1,2,4,8,16,32,64,128 using a loop. | |
i get this 'else' without 'if' error on this case: case 2: for(int i=0;i<currentRegisterdItems;i++){ System.out.println("#"+i+" - "+itemArray[i] + "\t\t\t" + priceArray[i]); System.out.println("Select products and add to cart - Simple Shop Software"); System.out.println("Enter the product id: "); int searchIdProduct = Integer.parseInt(a.readLine()); if(itemArray[searchIdProduct] != null){ System.out.println("Add "+itemArray[searchIdProduct]+" to your cart?"); System.out.println("Confirm: Y … | |
public class IC1 { private int x = 3; static int y=4; class Inner { public void inmet() { System.out.println(x + " " + y);} } public void do() { Inner i = new Inner(); i.inmet(); } public static void main(String r[]) { IC1 ic = new IC1(); ic.do(); } … | |
Hi All, I am a newbie of 8 weeks enjoying the challange of trying to understand java. I was assigned to create a rather challenging program in which the user is prompted to input a number from 1 to 10,000,000 then the number outputs in english words. For example- please … | |
Hello Friends, I want to set the length of the textfield in java... Please check my below code....it works finely if I press the keys one by one slowly... But suppose if I press any key for a longer time the actual length exceeds and so the validation is not … | |
hi guys i want your help i want to send email from private company email to yahoo or gmail company using java i will be thankful for any help | |
Hi i am using java code to connect to MS access using following url jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=C:/login.mdb Now if I need to connect to the run this java code from some other machine in network then how will I write the path "DBQ=C:/login.mdb" | |
I need to design and implement an application that reads a string from the user and prints it one character per line. import java.util.*; import java.text.*; public class EveryLine5 { //---------------------------------------------------------------------------------------------- // Reads in a string. //---------------------------------------------------------------------------------------------- public static void main (String[] args) { int length; char current; String msg … | |
Below is the java source code where I am trying to read a file and want to display its content on an applet which is opened through a html page. The problem is that when I try to open the applet through appletviewer there is not problem the data is … | |
I have a .txt file that has a text on it, and i want to read from it and show it on a JTextField but I dont know how to code it. So far here's what i know: viewIO = new DataInputStream(new FileInputStream(phoneList.getModel().getElementAt(phoneList.getSelectedIndex())+".dat")); for(int x = 0; x < 5; … |
The End.