22 Solved Topics

Remove Filter
Member Avatar for
Member Avatar for Varunkrishna

What is the mistake in this code, I am able to print the total digits of the input number, but when I try to print the *actual number* from the scanner it always prints zero(0). For example the user enters **123456** as the input, and my program is correctly returning …

Member Avatar for Prabhat_4
0
1K
Member Avatar for AssertNull

I've always been bad with regular expressions syntax. I am converting text into Bezier curves, polygons, etc. Part of that is identifying points in the form `(x,y)` where x and y are coordinates in a graph. I am extracting x and y as doubles and creating Point objects with those …

Member Avatar for AssertNull
0
359
Member Avatar for moaz.amin.37

My code is not compile and run Code is Below import java.util.Scanner; class Input { public static void main(String arg[]) { int rno; System.out.print("Enter Your Name = "); System.in.nextInt(rno); } } i think if System.out.println() is run then upper code should have to run but not run please solve this …

Member Avatar for moaz.amin.37
0
550
Member Avatar for kirtee2209

Hi. My company makes use of Motorola scanners to scan barcodes into the system through a C# application. A driver (Symbol COM Port Emulation Driver v 1.8.5) has been installed on the computers to make the scanner behave as simple COM Port Emulation and when the barcode is scanned, we …

Member Avatar for Ketsuekiame
0
1K
Member Avatar for Hanyouslayer

What I'm attempting to do is read a text document to pass in variables into an arraylist of shape objects that I will use to create shapes. I don't need any help with the actual drawing of the shapes, working with the arraylist, or the initial scanning setup. I thought …

Member Avatar for Hanyouslayer
0
799
Member Avatar for DarrelMan

I get an unknown source error when I try to use the Scanner class. fabric is the name of my Scanner ojbect. while(fabric.hasNext()) { fabricID[fabricCounter] = fabric.nextInt(); name[fabricCounter] = fabric.next(); description[fabricCounter] = fabric.next(); price[fabricCounter] = fabric.nextDouble(); qty[fabricCounter] = fabric.nextInt(); vendor[fabricCounter] = fabric.next(); fabricCounter++; System.out.println("made it down here"); }//end while fabric.close(); …

Member Avatar for JamesCherrill
0
293
Member Avatar for Pobunjenik

Hello, I'm Mirza and I'm in the first semester of an IT university. I like to experiment with Java, and occasionally I run into problems. Now, I've been visiting daniweb for quite a while now, and I've always found solutions to my problem, but this particular problem I just can't …

Member Avatar for JamesCherrill
0
428
Member Avatar for cmps

Hello!!! mmm am learning OOP in Java ... and now I'm facing a prob in reading/writing .txt file here's my code: import java.util.Scanner; import java.util.Formatter; import java.io.File; import java.io.FileNotFoundException; public class Tester { public static void main(String[] args) { Scanner scan = null; Formatter formatter = null; File fileI; File …

Member Avatar for cmps
0
2K
Member Avatar for Matth963

Hi, I'm doing a study planner in java. I'm doing a simple login system. For every user who registers a text file is created holding all of the information inputted during registration. This is the code of a method which the program uses to login the user: public void loginUser(){ …

Member Avatar for Matth963
0
294
Member Avatar for trishtren

Hey, Im trying to extract numbers from a scanner, but im having problems extracting them all. Primarily i need it to * read a text file which contains some text and numbers. * go through the file and locate all numbers * differentiate between numbers contained in bracket (3), and …

Member Avatar for trishtren
0
257
Member Avatar for VengefulToast

Will someone please tell me why I keep getting my custom file not found exception? The file is spelled correctly and is in the same directory of my java file. I am programming on Eclipse on Mac OS X. Here is my source: // Dillon Sheffield // Lab 10a // …

Member Avatar for VengefulToast
0
269
Member Avatar for LogicalOutlier

[CODE]public class Grades{ public int scoreTotal; public int numScores; double average; static String file = "randomNumbers.txt"; int lowest; int x; int temp; public static void main(String[] args) throws FileNotFoundException{ int scoreTotal = 0; int numScores = 0; double average = 0; int lowest = -1; int temp = 0; Scanner …

Member Avatar for NormR1
0
190
Member Avatar for JavaPrograms

My task is to: Pick 10 of my favourite NBA or NHL players from 2 top teams and display the player name, team name, points, rebounds, and assists for each of them. I then have to store this information as a table in a .txt file (This part is completed). …

Member Avatar for David Kroukamp
0
415
Member Avatar for dark_sider_1

Hi there, It's been a long time since I've used delimiters in the Scanner class in Java. If I wanted to have any numbers between an expression, such as xx/xx/xxxx or an infinite amount of numbers between them with just the forward slashes as delimiters, what would the syntax be? …

Member Avatar for JamesCherrill
0
212
Member Avatar for BaldingEar

Hi guys. I am getting the error: LoanProgram.java:17: variable payment might not have been initialized payment = getPayment (amount, rate, years, months, payment); I am stumped, and the lab is due tomorrow. If anyone could help me out I would greatly appreciate it. :) I'll put an asterisk on the …

Member Avatar for BaldingEar
0
330
Member Avatar for DarkLightning7

I cant seem to find the problem with this program I am building as a learning exercise. I am getting errors referenced to extremely simple pieces of code. In the output the first thing that should be printed is the random double number that the program selects then it should …

Member Avatar for DarkLightning7
0
261
Member Avatar for curbster

Hi all, I am in my first Java class at the local community college but my class is online and my teacher takes DAYS to respond via email. I need some help with my homework and thought I would try here. I'm not looking for someone to give me the …

Member Avatar for curbster
0
880
Member Avatar for boos800

I'm beginning a program that needs to read a file given in the command line. My first question is, if my command line looks like: $java mysimulator 5 proc.txt And I want to use proc.txt, which args[i] is it? Right now I'm assuming that the class name is args[0] and …

Member Avatar for boos800
0
4K
Member Avatar for ans025

Hello I am very new to Java and I really don't know exactly what I am doing. I know a little bit of other programming languages so I'm trying my best to figure it out for myself but I am supposed to: [B]Write a Java Application which will read a …

Member Avatar for NormR1
0
1K
Member Avatar for mmeclimate

Hi everyone, I am new to java and I wrote a program that does the following (using Scanner): Name: Last Name: Age: (More? Y/N): When the user presses Y, he/she can add more information. Then in the end, I want to print something like: The participants are: Soni Smith (30), …

Member Avatar for mmeclimate
0
150
Member Avatar for redlyfs

import java.util.Scanner; public class BookRentalSystem { public static void main(String args[]) { //Declaration of variable and instances String bTitle, bType, bAuthor, bISBN, bStatus, search; int choice = 1; int bCount = 0; boolean found; Scanner input = new Scanner(System.in); Book[] books = new Book[5]; //Executing user's selection from menu. Exit …

Member Avatar for redlyfs
0
218
Member Avatar for EGutierrez91

[code] import java.util.Scanner; public class LazyDays { public static void main (String[] args) { Scanner scan = new Scanner(); int temp; System.out.println ("What is the current temperature?"); temp = scan.nextInt(); if (temp < 20) { if (temp > 95) { System.out.println("Go visit our shops!"); } } if (temp >= 80) …

Member Avatar for Grn Xtrm
0
134

The End.