32,199 Topics

Member Avatar for
Member Avatar for RabbitruN

/*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()... …

Member Avatar for sanketh_java
0
260
Member Avatar for hakeemtunde

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 …

Member Avatar for hakeemtunde
0
177
Member Avatar for Mauricejude1

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

Member Avatar for JamesCherrill
0
95
Member Avatar for sam.ndhlovu

Hi everyone,can anyone explain to me how to develop the Sokoban game in Java?Like a step by Step,am a newbie

Member Avatar for JamesCherrill
0
44
Member Avatar for Neversleepin

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 …

Member Avatar for JamesCherrill
0
177
Member Avatar for eskember

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. …

Member Avatar for harinath_2007
0
787
Member Avatar for Malymieczek

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 …

Member Avatar for Malymieczek
0
127
Member Avatar for Lushomo
Member Avatar for Taywin
0
52
Member Avatar for babi.meloo

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 …

Member Avatar for Taywin
0
1K
Member Avatar for Kayla1993

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 …

Member Avatar for Taywin
0
92
Member Avatar for Pyler

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 …

Member Avatar for Taywin
0
215
Member Avatar for babi.meloo

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 …

Member Avatar for babi.meloo
0
2K
Member Avatar for jakubee

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 …

Member Avatar for Taywin
0
1K
Member Avatar for murthybn99

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). …

0
66
Member Avatar for waf4hmad

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 …

Member Avatar for waf4hmad
0
2K
Member Avatar for taylor.mitchell.353

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 …

Member Avatar for taylor.mitchell.353
0
120
Member Avatar for jockfaire

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).

Member Avatar for jockfaire
0
109
Member Avatar for Hemanth.Satkuri

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. :)

Member Avatar for Hemanth.Satkuri
0
101
Member Avatar for Hemanth.Satkuri

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 …

0
74
Member Avatar for 1bung100

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 …

Member Avatar for JamesCherrill
0
2K
Member Avatar for paidah

## 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.

Member Avatar for JamesCherrill
0
140
Member Avatar for aabbccbryanmark

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 …

Member Avatar for JamesCherrill
0
124
Member Avatar for rahul.ch

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(); } …

Member Avatar for rahul.ch
0
195
Member Avatar for phovasia

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 …

Member Avatar for JamesCherrill
0
220
Member Avatar for poojavb

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 …

Member Avatar for JamesCherrill
0
3K
Member Avatar for lena1990

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

Member Avatar for Ezzaral
0
239
Member Avatar for abhishek20

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"

Member Avatar for Pradeeps206
0
343
Member Avatar for babi.meloo

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 …

Member Avatar for JamesCherrill
0
2K
Member Avatar for reenarankawat

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 …

Member Avatar for JamesCherrill
0
980
Member Avatar for techxaidz

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; …

Member Avatar for JamesCherrill
0
114

The End.