Search:

Type: Posts; User: Dingles

Search: Search took 0.13 seconds.

  1. Writing a while loop to read positive integers from the user until the user enters the EOF character.

    import java.util.Scanner;
    public class Project_5
    {
    public static void main (String[] args)
    {
    Scanner input= new Scanner (System.in);

    int inputNum, sum = 0;
    int numValid =...
  2. Replies
    9
    Views
    1,399

    Re: Java Program with text file - Help!

    If I open the file with a text editor it seems to be a space in between each number. If it was not a space would i just have to change the split(" ") to whatever the character is?
  3. Replies
    9
    Views
    1,399

    Re: Java Program with text file - Help!

    It is a space in between each number.
  4. Replies
    9
    Views
    1,399

    Re: Java Program with text file - Help!

    import java.io.*;
    import java.util.*;

    public class readFile {
    static Scanner infile = null;

    public static void main(String[] args) throws IOException {

    infile = new Scanner(new...
  5. Replies
    9
    Views
    1,399

    Re: Java Program with text file - Help!

    Ahhh so I need to use an array to split up the data in the txt file. Is there a specific spot in the code where the array needs to go?
  6. Replies
    9
    Views
    1,399

    Java Program with text file - Help!

    I've been given a coding problem that I'm having trouble with. I've been given the code below along with a text file. The text file contains the folowing:

    Chen Ruolin...
  7. Re: Spaces at the start of every other line in a for loop

    Thanks for the replies everyone. I'd like to point out that Junky is correct! I made a typing error with the 5x5 output of A's. If the user enters 4 it will output 4x4.
  8. Spaces at the start of every other line in a for loop

    I'm attempting to get spaces at the beginning of every other line of the output of this program:

    import java.util.Scanner;
    public class Checkerboard
    {
    public static void main(String[] args)...
Results 1 to 8 of 8