I need to print certain information from an arraylist depending on the arguments the method has. I'm trying to print the last 3 methods from the database class but nothing is printing and I don't know what the problem is.
package hw3;
import java.util.*;
public class Driver {
public static void main(String[] args){
/* Comments required
PersonFileReader pfr = new PersonFileReader("person.dat");
ArrayList<Person> testData = pfr.readData();
Database db = new Database(testData);
*/
[Code] .....
On the driver class I just print what the methods from the database class do.
I am trying to write a loop that calculates the distance traveled (distance = speed * time). It should use the loop to calc how far the vehicle traveled for each hour of time. My program asks for hours and then mph but its not calculating time * speed. Here is my code.
public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Enter Hours Traveled "); int hoursTraveled = input.nextInt(); System.out.println("Enter MPH "); int mph = input.nextInt();
Currently, my program converts Long values to String. And when I test it out, it do print out the correct output. However, when the converted String value is passed over to be written in a text file, it seems that BufferedWriter isn't printing out the outcome that it's supposed to be.
saltVs = Long.toString(saltV); System.out.print(saltVs); //will print out 79723172
Now the problem is here...It only prints out the last digit of the String value (instead of 79723172).
Here is my FileWriter/BufferedWriter part.
Why is that when I run my program using command prompt, it prints out the output that I wanted, but however when it comes to writing to the file, it doesn't come out right.
I'm doing a program where a user enters in exam results for students. Once he's entered the code, the code should split the results in stars in 4 categories.
I am working with a while loop that prints out infinite results. What I want to do is, if the user enters 2 digits, say "12", it should output 1 "*".
If the user enters "21" and "22", it should output "**".
There are 4 categories of marks which are marked with ints range1, range2, range3 and range4, which are user enter digits. Part 1 of the code is to split the user entered digits into its correct ranges. the ranges are 0-29, 30-39, 40-69 and 70-100. I've done the part where when the user enters a digit, it goes into the correct variable. After that when the user enters a digit over 100, the enter results should show up as stars. For example
Enter number =
21 22 44 66 44 23 11 111 (the 111 is where the program breaks and moves on)
So it should then display
0-29 ****
30-39
40-69 ***
70-100
Whatever I'm trying, it displays an infinite amount of stars. If I try to use break, It only outputs a single star, no matter how many digits I enter
Here is the code
int mark = 0; int range1 = 0, range2 = 0, range3 = 0, range4 = 0; int count1 = 0, count2 = 0, count3 = 0, count4 = 0; while (mark >=0 && mark <=100) {
[Code] .....
"The problem is with the while loop, the one above is something I was experimenting with "
Right, so I got this method that creates and sorts 2 lists. What I want to do is merge these lists into a third list, have it sorted, and then print the contents of the list. The problem is, I'm tired and I don't remember how I can print it.
import java.util.*; public class MergeTwoSortedListWilson { public void CHANGEME() { // To do ArrayList<String> aList = new ArrayList<String>(); aList.add("Banana");
[Code] ...
MergeTwoSortedListWilson.java:35: error: cannot find symbol System.out.println(aList); ^ symbol: variable aList location: class MergeTwoSortedListWilson 1 error
Here is the java code that i compiled on eclipse but each time i run it i am getting different sequence of output !!
What I did is that my main() calls a function m1() which calls a function m2() which throws an exception back to m1() which throws exception back to main().
public class ClassB { public static void main(String[] args) { try { m1(); } catch (Exception ex) { ex.printStackTrace();
[Code] ....
The output is as shown in screenshots at different times :
I have wrote the necessary program for the class which was : Modify the customer class to include changeStreet(), changeState(), and changeZip methods. Modify the account class to include a changeAddress() method that has street city and zip parameters. Modify the Bank application to test the changeAddress method.
The problem arose when I went to test it. For some reason when it asks "Would you like to modify your account information? (y/n)" it will not allow the user to input anything and thus test the class. Here is my code
Class Customer import java.util.*; import java.io.*; public class Customer { private String firstName, lastName, street, city,state, zip;
My issue is that when I run my search, it does find a goal. However, when I try and print the route using my print route method, it just gets stuck in a loop of printing the same two nodes. What is wrong with My A* implementation?
i am trying to run a command in terminal the code is below if i run the command in terminal it works fine however when i run it from netbeans with code below nothing gets printed. however if i run a different command such as (ip addr) it works fine?
public static void a() throws IOException{ ArrayList lister=new ArrayList(); Runtime rt = Runtime.getRuntime(); Process proc = rt.exec("ps -ef | grep firefox");// the command i am trying to run to get pid of application InputStream stderr = proc.getInputStream();
I develop a little app in javaee6 and jsf2. I have a search page which has a search form with 2 fields and a search button when i click search button the results should be displayed in searchresults page.
Issue: searchresults page is is not displaying records though it fetched records from table I'm able to achieve this using search bean as session scope but i want to use the scope as Requestscope.
how to display results in a PLAIN_MESSAGE. My program is converting hex to decimal and displaying the results. Here's the code:
package pkgfinal; import javax.swing.JOptionPane; import java.util.Scanner; public class Final { public static int Convert(String userInput, int base){ int running_sum = 0;
I have the code here to populate a GUI. I have the math and then print out and return a single number. I have tried to use setText in the class CalculateButtonHandler.
import javax.swing.*; import java.awt.*; import java.awt.event.*; public class RectangleProgram extends JFrame { private JLabel lengthL, widthL, areaL, perimeterL, averageL;
I wrote this small program to take an octal number from the user and convert it to decimal form.
import java.util.Scanner; public class Decimal { public static void main (String args []) //gets octal number from user, later prints conversion { int octal;
[Code] .....
Some conversions work. For example, 77 will be correctly converted to 63, and 77777777 will be converted to 16777215. However, some conversions do not work. An example of this is 775002 gets converted to 74898.
I'm working on a simple site for my friend, and he asked me to link to his other site. I need to have the link to a specific search. For example, if I search for "Heathrow," I need to be able to link a button on the other site so that it can be clicked and directed to the search results on this page. Problem is that this is apparently all Java (which I know nothing of) and how to just copy a link to the results page.
I don't see any nodes that I add. Not sure why getting this error.
duplicate found Exception in thread "main" java.lang.NullPointerException at binarysearchtree.delete(binarysearchtree.java:111) at binarysearchtree.main(binarysearchtree.java:196) Java Result: 1 public class node<T>
I'm trying to run the following java program by using the instructions provided here URL....The program tries to connect to LDAP directory, searches for an objectGUID and returns sAMAccountName...But when I compile the java program I get 19 errors as given below.
/a1/utils/seek.java:2: cannot find symbol symbol : class string location : class seek public static void main (string[] args) {
I am having the hardest time trying to figure out how to display an array in a 1-window GUI.
I can display 1 book separately, by basically ignoring the array and creating a new object for each book, but I need all 5 books to display in one window, and that's where I'm lost. I'd really like to use the arrayI built to generate the books in the GUI. The information of each book appearing horizontally, and the different books appearing vertically.
// Bookstore.java // This program displays information on multiple books
i am trying to turn an int number etc. 6 into 6 symbols the result would be "------". how can i transform int=6 into "------"? what function do i have to use to do this count?
public class Diagram { public static void skrivDiagram() { Random rand = new Random(); int[] frequency = new int[13]; {
for (int roll = 1; roll <= 100; roll++)
[code]....
Here i want to transform the frequency[face] into "-".
I've recently started programming with lwjgl, playing around with some 3D graphics. I've built a house and now I'm trying to render a view looking straight onto the center of the roof, but with current configuration it's slightly off.
As you can see in the image the edges on the roof aren't perfetly straight which would be the case if I was looking straight to the center from a point on the roof normal vector. I'm using gluLookAt to get the view, using the following code:
Well, I have a list inside of a java class then i want to call that list into the jsp to show the results. That list has results from a query, everything is ok in java class because it shows me just one result in jsp, i read that it can be do with a for or enhanced for but been honest i have try everything and nothing work.
I can now call the DB on the query I want and return results. What I know want to do is build an array of the data, forward it to the JSP page and display the bits individually.