import java.util.Scanner; import java.util.Random; class Lottery { // MISSING CODE } public class LotteryDemo { public static void main(String[] args) { int[] userPicks = new int[5]; int matching; // Create a Scanner object for keyboard input. Scanner keyboard = new Scanner(System.in); // Create a Lottery object. Lottery lotto = new Lottery(); // Get the user's picks. for (int digit = 1; digit <= 5; digit++) { System.out.print("Enter digit " + digit + ": "); userPicks[digit-1] = keyboard.nextInt(); while (userPicks[digit-1] < 0 || userPicks[digit-1] > 9) { System.out.print("ERROR. Enter a single digit (0 - 9): "); userPicks[digit-1] = keyboard.nextInt(); } } …

Member Avatar
Member Avatar
+0 forum 3

when i am trying to insert date into the datefield of the oracle then date value are stored in to database but each date value are same like DOB 01-JAN-70 01-JAN-70 01-JAN-70 public class practicdate { JDateChooser dateChooser,dateChooser1; practicdate(){ dateChooser = new JDateChooser(); dateChooser.setBounds(200, 200, 150, 20); getContentPane().add(dateChooser); public void actionPerformed(ActionEvent e) { java.util.Date utilDate=(java.util.Date) dateChooser.getDate(); java.sql.Date sqlDate=new java.sql.Date(utilDate.getDate()); try { java.sql.PreparedStatement ps=con.prepareStatement("insert into examdate values(?)"); ps.setDate(1,new java.sql.Date(sqlDate.getDate())); ps.executeUpdate(); ps.close(); con.close(); }

Member Avatar
+0 forum 0

Hey, I'm trying to open a web page inside my newest android app. (I'm following this guide...) [url]http://developer.android.com/reference/android/webkit/WebView.html[/url] My goal with the app is to open up the web page every time it gets opened, but the web pages need to open within the activity. With the code below, it does open the web page, but inside the browser app, how can I open the web page inside my own app? What specific changes do I need to make on my .java activity file, and my .xml layout file? [CODE]// part of .java activity file WebView webview = new WebView(this); …

Member Avatar
Member Avatar
+0 forum 2

Are there any differencies between these two code ? if (!a.equals("")) { editDate.setText(a) } and if (a!="") { editDate.setText(a) }

Member Avatar
Member Avatar
+1 forum 3

Hi guys, I wonder if this is something I could do on this forum. I've never worked with REST, so I thought that it could be a good exercise to try to develop a very small and simple Java application and try to make use of REST as well. I found a brief which seems simple enough, I'll share it with you (I'm happy to change this of course if you think it's useful as for me it's just practice). As a Rest Client I want to submit new orders for bricks So I can start customers’ orders Given A …

Member Avatar
Member Avatar
+0 forum 50

Hi all I need help to read outlook pst file from java.My pst file is stored in local hard disk.Now i want my java program to read that pst file.Kindly provide some inputs so as to proceed to the solution for the said problem.Can i do this through javamail api? Thanks and regards Umadas

Member Avatar
Member Avatar
+0 forum 8

Hi all, i have userid ,username,password now i want login using this query how; select username,password from tablename where userid=userid;

Member Avatar
Member Avatar
+0 forum 1

I have developed a game for android mobiles ["Rise Up Air Balloon"](https://play.google.com/store/apps/details?id=com.abacus.riseup). I want to updatte it. Kindly suggest me something if it is better to update https://lh3.googleusercontent.com/rB-fPEBiaGzT_ubSzCtSfftC4pKkIm5buAS2_DhQz4_exYFCrjbcN2T1NhkmM0A3Jj0=s180-rw

Member Avatar
Member Avatar
+0 forum 1

iam using oracle11g and jsp ,i have one task there i want use isActive how to use that. i dont know atlease what is isActive please explain.

Member Avatar
+0 forum 0

hai all , iam using the jsp in that i have small dought , DBtable: id,description,created by ,create time,modified by ,modified time ,isactive Jsp: i want to store that values in databse using the jsp;here id is auto increment,description is user enter ,created by created by ,create time,modified by ,modified time system will take automatically,,isactive is used to delete using the boolean if true data is here,or false data is not there . plese help me.

Member Avatar
+0 forum 0

how can we use math .pi without using impot java.lang.Math*; PROGRAMING LANG:- JAVA

Member Avatar
Member Avatar
+0 forum 2

I am making a ping pong game using JavaFX, but before I am going to make that, I like to test the KeyEvents. I made a simple ping pong game about 2 years ago, but I like to improve my game. And was pretty bad controlls back when I made the ping pong game, because of the not smooth controls. so here is the problem: whenever I holdpress A and switch quickly to holdpress D or D to A, same with (W to S and S to W). it just takes a little break and then move, is there something …

Member Avatar
Member Avatar
+0 forum 4

So, I made a simple server-client chat program, but I have a problem: if the server tries to message the client, the server lags or freezes a bit, same with the client. is there something that I do wrong? import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.net.ServerSocket; import java.net.Socket; import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.TextArea; import javafx.scene.control.TextField; import javafx.scene.paint.Color; import javafx.stage.Stage; public class Server extends Application { private Group serverGR; private Scene serverSC; private Stage window; private TextField tf; private TextArea ta; private ServerSocket ss; private Socket s; private DataInputStream dis; private DataOutputStream dos; ConnectionThread cT = new …

Member Avatar
Member Avatar
+0 forum 14

So I am making a responsive audio waveform, if you don't know what that is, it is something like this: (btw this is my goal to make those audio waveforms). https://i.ytimg.com/vi/J7uN-SQtOYI/maxresdefault.jpg https://www.youtube.com/watch?v=OVMuwa-HRCQ https://www.youtube.com/watch?v=SCD2tB1qILc I don't know how to describe it, so just look at the videos and image. but my question is, how do I get the values from the "AudioSpectrumListener", it has a lambda expression. And I need the value of the magnitude. So I can print out the values. Later I will use the values to make rectangles and that rectangles will change height shape because of the …

Member Avatar
Member Avatar
+0 forum 17

Hii Guys I am currently Devloping a Java Remote Desktop Software like teamviewer I would like know some guidelines about the tools I can use for client and server side I could create a GUI using Swing and add by using Robot class to imitate mouseactions and keyactions and by using screen capture and Compression and TCP/socket programming I could send the images Is it the best efficient way to acheive this ?Are there any other latest tools/protocols which are faster ? By googling a lot I found RDP and VNC a lot of times ?What are they

Member Avatar
Member Avatar
+0 forum 12

Hi developers! I have made a POS software. I have added the functionality of "priniting to Thermal printer" and "barcodes". Firstly I added the functionality of Reciept printing which worked perfectly. Then I added the functionality of barcode scanning. As you know barcode reader device automatically scans the barcode and write the barcode in Text field or excel sheet. But in the sales screen , all the field of item/product should be populated from database When barcode is scanned. I implemented an interface(I get this code form internet) in the my Sales Screen Constructor. It workded perfectly for me, but …

Member Avatar
+0 forum 0

Hi developers! I have made a POS software. I have added the functionality of "priniting to Thermal printer" and "barcodes". Firstly I added the functionality of Reciept printing which worked perfectly. Then I added the functionality of barcode scanning. As you know barcode reader device automatically scans the barcode and write the barcode in Text field or excel sheet. But in the sales screen , all the field of item/product should be populated from database When barcode is scanned. I implemented an interface(I get this code form internet) in the my Sales Screen Constructor. It workded perfectly for me, but …

Member Avatar
+0 forum 0

I am making a program, and I don't know why my program becomes unresponsive, when I click the button ): I have a feeling its because of this: "connection = server.accept();" I don't know how to fix it. I am trying to recreate this: https://stackoverflow.com/questions/18505123/how-to-use-client-chat-on-different-pc but in javafx. package yeetYeet; import java.io.EOFException; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.net.ServerSocket; import java.net.Socket; import javafx.animation.AnimationTimer; import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.TextArea; import javafx.scene.control.TextField; import javafx.scene.paint.Color; import javafx.stage.Stage; public class Server extends Application{ private ObjectOutputStream output; private ObjectInputStream input; private ServerSocket server; private Socket connection; //set up and …

Member Avatar
Member Avatar
+0 forum 16

When we build an application, which layer should we start with? From top (UI) to bottom(Data Layer) or bottom to top?

Member Avatar
Member Avatar
+1 forum 6

[B]I've highlighted the code in question in red. Can somebody tell me how the red code makes Pac man and the Ghosts move?[/B] [code]// // PacMan // Another 1 day game (created in 5 hours). // // (C)2000 // Brian Postma // [email]b.postma@hetnet.nl[/email] // [url]http://www.homepages.hetnet.nl/~brianpostma[/url] // import java.awt.*; import java.applet.Applet; public class PacMan extends Applet implements Runnable { Dimension d; Font largefont = new Font("Helvetica", Font.BOLD, 24); Font smallfont = new Font("Helvetica", Font.BOLD, 14); FontMetrics fmsmall, fmlarge; Graphics goff; Image ii; Thread thethread; MediaTracker thetracker = null; Color dotcolor=new Color(192,192,0); int bigdotcolor=192; int dbigdotcolor=-2; Color mazecolor; boolean ingame=false; boolean showtitle=true; …

Member Avatar
Member Avatar
+0 forum 7

H! I am writing a java proram in which I need to generate and read barcodes to and from .PNG images. I used barcode4j-2.jar library to generate barcodes and write them to PNG image. I did this successfully. But I faced an error during reading that generated barcode from the image. I used "OnBarcode.BarcodeReader.jar" library to read the barcode but it give s me folloiwng error: java.lang.NoClassDefFoundError: com/sun/media/jai/codec/SeekableStream at a.a.b.a.a(a.java) at a.a.d.a(d.java) at a.a.d.a(d.java) at a.a.d.b(d.java) at a.a.d.a(d.java) at a.a.d.e(d.java) at a.a.d.c(d.java) at a.a.d.a(d.java) at a.a.d.a(d.java) at OnBarcode.Barcode.BarcodeScanner.BarcodeScanner.Scan(BarcodeScanner.java) I am pasting the code here: public void ReadBarcodeFromImage() throws FileNotFoundException,IOException // …

Member Avatar
Member Avatar
+0 forum 1

Hi guys, as part of an exercise I was involved with, I had to use the factory pattern to create a series of different objects, however I'd like to keep a list or map for what it matters of these objects and I'm getting a bit into troubles here. So basically, I have a CSV file containing some data which I'd like to use to construct my objects: the data in the spreadsheet is arranged in the following cols: name, surname, date_of_birth, type and I'm essentially reading from the spreadsheet and using the factory pattern I'm building a series of …

Member Avatar
Member Avatar
+0 forum 4

i have define code File selectedFile = new File(selectedFilePath); when run and test is it file or not if (!selectedFile.isFile()){ runOnUiThread(new Runnable() { @Override public void run() { tvFileName.setText("Source File Doesn't Exist: " + selectedFilePath); } }); return 0; it give message source file does't exist; why give this message, i have allready convert full code public int uploadFile(final String selectedFilePath) { int serverResponseCode = 0; String file_name = selectedFilePath; HttpURLConnection connection; DataOutputStream dataOutputStream; String lineEnd = "\r\n"; String twoHyphens = "--"; String boundary = "*****"; int bytesRead,bytesAvailable,bufferSize; byte[] buffer; int maxBufferSize = 1 * 1024 * 1024; File selectedFile …

Member Avatar
Member Avatar
+0 forum 1

hello everybody who can help with this task Now I will talk little about monoalpahapit cipher This is cipher is based on substitution the characters with another characters So in the encrypt.java file it counts how many the characters appeared in the cipher text , so in the picture that I sent to you it contains the statistics of most frequently characters, an example : suppose in the cipher text the character ( O ) appeared 16 times and it’s the most frequently character so you will back to the picture of the statistics and see what is the most …

Member Avatar
+0 forum 0

Hello. As a personal project, I am trying to create a "Java Argot" translator. However I am having some issues. The purpose of the program is to translate a sentece into the following "Secret Languages": "Pig Latin", "Leet" and "Morse Code". I have only done the "Pig Latin" translator however, everytime I try to activate case one in the "switch case" I get the error message "Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 0". The program shows that the line of code that is sending this message is these two lines: "`PigLatin_Translator.main(word);`" in the "Translator Menu" and …

Member Avatar
Member Avatar
+0 forum 17

Hi guys, I was trying to sort an arrayList using a comparator but I didn't have much luck, or at least it seems like there is something slightly wrong with it. I have these objects in the arrayList employeeCollection.add(new Employee("Dan", 112)); employeeCollection.add(new Employee("Tim", 2)); employeeCollection.add(new Employee("Rick", 11)); employeeCollection.add(new Employee("Jack", 19)); employeeCollection.add(new Employee("Sid", 1)); and before sorting I have this Name: Dan: ID number: 112: Name: Tim: ID number: 2: Name: Rick: ID number: 11: Name: Jack: ID number: 19: Name: Sid: ID number: 1: and after sorting I have this: Name: Dan: ID number: 112: Name: Jack: ID number: 19: …

Member Avatar
Member Avatar
+0 forum 4

When posting code, I get error > begin a line with 4 spaces in a row (or one tab), preceded by a blank line. 4+ spaces or tabs may not be used anywhere else.

Member Avatar
Member Avatar
+0 forum 8

Halli Hallo i hope im at the right Place. I want to get started with API-Gateway(s). Currently im running 5 Microservices written in Java (Spring-Boot) deployed via Docker. Each Microservices is protected via Keycloak. I want to use a API-Gateway so that i can combine every MS into 1 Link: * demo.com/api/ms1 * demo.com/api/ms2 * ... And more important i want to have the Authorization at one Place and not in everysingle Microservice. I found a couple of Solutions but im not sure which to use or if i maybe should write my own one? I was intrested in checking …

Member Avatar
Member Avatar
+1 forum 2

I am making an adroid application. I am saving sales data on firebase with current date. I have formatted the System.currentTimeMillis() into SimpleDateFormat. The date is successfully stored on firebase . Now I want to retrieve sales between two dates. I made two demo sales, one on (30-5-2019) and second on (31-5-2019). For retrieving the sales data I have just put two above mentioned static dates in my Query and ran it . The problem is that it only gives me one sale record between two dates. It should give me 2 sale records. Below is my source code. // …

Member Avatar
Member Avatar
+0 forum 1

currently working on a project for college. when searching coffee names from the array list , it will show the object but will also show "there is no coffee in the list" for every time the object doesn't match the search, how can I sort this out? public static void search () { boolean arrayName = false; if (numberOfCoffees > 0) { System.out.println ("search coffee"); System.out.println ("what are you searching for?"); String search = sc.nextLine(); for (int i = 0; i < numberOfCoffees; i++) { arrayName = coffee[i][0].equals (search); if (arrayName == true) { System.out.println("coffee found: " + coffee[i][0] + …

Member Avatar
Member Avatar
+0 forum 1

The End.