32,199 Topics
| |
Hello everyone at Daniweb! This is my first post here, sorry if i do something wrong. Ok, so just a quick background on me and where I'm at in java. This year I'm taking my first Comp Sci class as CSUN (Cal State University Northridge). I am a complete beginner … | |
I'm trying to write a test class which shows the user the following menu and implements all options. The program should continue to run and process requests until the user chooses to exit. The program should double-check that the user really wants to exit. All input must be validated and … | |
Hey guys! I'm trying to figure out how to create a program that lets the user find a picture on the hard drive and display the picture. How can I accomplish this? | |
Hi, I have an XML, I need to create 2 classes: 1. For converting XML into XSD for getting its node objects. 2. For fetching values in each node. I have to use JAX-B for this but I don't know the steps. Please suggest some procedure or decent tutorials I … | |
I have a tic tac toe board i am finding it hard to figure out how to change parts of the array that contains char. I am looking for a way to to ask the user to select a char to change in the the array and then once they … | |
I m new.I am not getting any result for Number of A Number of B Numbers of C Number of D number of F for A,B,C,D,F i always get 0. [CODE]import java.util.Scanner; public class ExamScores1 { public static void main (String[]args) { String a; int count= 0; int grade=0; // … | |
I am trying to read a file using a string input as the filename. For example, if the filename is datafile.txt then if the input is "datafile.txt" and there is a file of that name in the directory, how do I read it? Here is my initial code: [CODE]Scanner kbd … | |
Hi all, Does anyone know how to read a .doc file with reader in java? Is it possible to read a doc file the same way you read a txt file? Thanks in advance | |
it says can not find symbol.... [CODE]import java.util.Scanner; public class wage2 { private static Scanner Reader= new Scanner (System.in); // private static double OverTimeRate=1.5; public static void main(String[] args) { //constants double person_Name; double hourly_wage; double regular_hours; double overtime_hour; double regularpay; double overtimepay; double totalpay; person_Name=InputPersonName(); hourly_wage=InputhourlyWage(); regular_hours=InputRegularHours(); overtime_hour=InputOvertimeHours(); regularpay=regular_hours … | |
I can't get the object array in lab9 class (named "thelist") to be populated with objects from the Foreign class. please see line 35 in lab9 class. I've tried using toString, useing a Foreign type variable as a parameter in a addData(), a addData() method ect... I am really really … | |
I am new to Java and I am having trouble knowing if my array is populating when I click the enter button and printing out the data into the text area when I click the run reports button. When I put data in the text boxes the boxes are being … | |
Ok so my problem should have a fairly simple fix. My program takes the number of families and their income and prints the families that make less than 10% of the maximum income. Below is a sample run. Please enter the number of families: 5 Enter an income: 8500 Enter … | |
My problem is in the guessing method, I am not sure if the way I set up playing the game again works, (don't know if entering yes will work) and I'm not sure on how to call the main method to play again, and also I'm suppose to give the … | |
No I know that in order to compare a String you have to call its method .equals but how I check if a String is NOT equal to something? Will it be something like if ("hello" != String.equal())?? or is there a special method? I know I'm being dumb here … | |
I'm getting Error: `<identifier>` expected and not sure why, any tips? public class BioCalc { // instance variables private Date myToday;//Date object today private Date myBday;//Date object birthday private int myDaysAlive;//birthday-today private final int PCYCLE=23;//physical length private final int ECYCLE=28;//emotional length private final int ICYCLE=33;//intellectual length /** * Constructor for … | |
Hello. I'm attempting to start a Caesar cipher program and can't get the program to display the output key[1]. Here is my code: [CODE]import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class Caesar { private String[] key = new String[26]; public static void main(String[] args){ Scanner kbd = new Scanner(System.in); String … | |
Can anyone develop the Ideal height calculator with following specifications? The picture of required software is attached Write the ideal weight calculator so that height in inches is entered by using a slider. Use the approximate formula: W = H2 / 30 , for female W = H2 / 28 … | |
i am trying to put this together so it opens a file sorts the data saves a file and appends a file i have got my self so confused. can any one help???? this is the code Ive got so far. [code]import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileReader; import java.io.FileWriter; import … | |
Hi everyone I have an exam coming up soon, and now is the time for review. I have some questions regarding this review, I will only ask the ones I am so unclear about. [CODE]How many times will the following do-while loop be executed? int x = 11; do { … | |
[CODE] package primecdesc; import java.util.Scanner; public class Primecdesc { public static void main(String[] args) { Scanner myScanner = new Scanner (System.in); int a,b=0,ctr=0, ktr=1; System.out.print("Enter a number: "); a = myScanner.nextInt(); while(b>=1001) { if (a%b==0) b++; ctr--; } /*for(b=1;b<=1001;b++) { if(a%b==0) ctr--; }*/ if(ctr==1) { System.out.println(a + " is a … | |
I get this error in my Java programme which coded by me according to a tutorial.I coded it to connect my Java App with MySql database.This is the code.[CODE]package Gui; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; import java.sql.SQLException; /** * * */ public class connectionconfig { private connectionconfig() … | |
I want display 2nd cycle after sleeping 1st cycle time 1 second after that display 2nd ,3rd and so on.... I bold my thread code in above program.... [CODE] public class MainDrawCycle extends JPanel implements ActionListener ,Runnable { JButton button; JLabel lblclkValue,lbldispValue,lblTitle; JTextField textField; JScrollPane pane; JPanel panel; JFrame frame; … | |
hey i have written this code to make a GUI but it compile correctly but gives error at run time. the error is exception in thread main "java.lang.NullpointerException" at GUI.intGUI(GUI.java:22) at GUI.(init)(GUI.java :75) at GUI.main (GUI.java:79) the code is [CODE]import java.awt.*; import javax.swing.*; import java.awt.event.*; public class GUI { JFrame … | |
import java.util. *; import java.util. ArrayList; public class Module { private int moduleCode; private String classlist; private ArrayList<String>studentsEnrol; public Module(){ studentsEnrol = new ArrayList<String>(); } public void storestudent(String student){ studentsEnrol.add(student); } public String classlist(){ return classlist(); } This is a code i wrote, the code meant to store student in … | |
i need to know which is better? whether DataInputStream or BufferedReader or scanner? | |
[CODE]class Mammal { String name = "furry"; String makeNoise() { return "generic noise";} } class Zebra extends Mammal { String name = "stripes"; String makeNoise() { return "bray";} } public class Zoo { public static void main (String[] args) { new Zoo().go();} void go() { Mammal m = new Zebra(); … | |
Hi i am looking for following output.I am just getting 0 for a,b,c,d,f. total no of grades Number of A's Number of B Numbers of C Number of D number of F [CODE]import java.util.Scanner; public class ExamScores { public static void main (String[]args) { String a; int count= 0; int … | |
I'm finding it difficult to implement an in-place algorithm for bucket sort. The question and my attempt are below. Can anyone give me a hint or an explanation of how I can implement in-place bucket sort? Q: Use the bucket sort idea to sort in-place an array of n records … | |
Hello forum, I want to write a simple code of two dices rolling for two players. The players can roll as many times as they want per turn. If they are matching numbers, the total is zero. If a person passes, it is passed on to the next player. Please … | |
[CODE]import java.util.Scanner; import java.util.Random; public class test { public static void main(String[] args) { Random rand= new Random(); // being able to use random object int[][] array = new int[3][9]; // print array in rectangular form for (int i=0; i<array.length; i++) { for (int j=0; j<array[i].length; j++) { int k … |
The End.