Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Not sure what to do next!

  1. #1
    Junior Member
    Join Date
    Feb 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Not sure what to do next!

    Hello,

    I'm very new to Java Programming, and I've been working on a project. Probably easy, I just can't seem to know what to do next.

    Well basically creating an ASCII table.

    I prompt a user for a number , which will define my number of groups in my table. ( I've already prompt the user)

    I produce an ASCII table from 0 -127

    Im organizing my groups in 3 tables displaying values as a char, in hex, and in decimal.

    When I print the number of groups defined by the user, i need to input a new line and continue.

    I know my solution must use a loop that goes from 0 - 127, and a second control structure to determine where to start a new line when i have enough groups printed.


    package first;
     
    import java.util.Scanner;
     
    public class Main {
     
        public static void main(String[] args) {
            Scanner input = new Scanner(System.in);
            int userNum;
     
            System.out.println("Enter an integer: ");
            userNum = input.nextInt();
     
            while (userNum < 128) {
     
                if (userNum > 6 && userNum < 9 || userNum == 13) {
                }
            }
     
     
     
        }
    }


    So im not asking anyone to give me the answer, but I want to know if im on the right track or not, and if so perhaps you can point me in the right direction or suggest type of tutorials that will help me. Im really do want to learn and not just copy paste.
    Thanks

    Oh this is the sample output im sure that will give a better understanding of what im trying to achieve.
    sample.jpg

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,166
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Not sure what to do next!

    You don't seem to have any println statements. You'll need some to print out the table.
    You can use print() to put data on one line and then use println() to move to the next line.

    Instead of an image copy and past the console output here.
    To copy the contents of the command prompt window:
    Click on Icon in upper left corner
    Select Edit
    Select 'Select All' - The selection will show
    Click in upper left again
    Select Edit and click 'Copy'

    Paste here.
    Last edited by Norm; February 2nd, 2012 at 07:24 PM.

  3. #3
    Junior Member
    Join Date
    Feb 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Not sure what to do next!

    Microsoft Windows [Version 6.1.7600]
    Copyright (c) 2009 Microsoft Corporation. All rights reserved.

    C:\Users\Davor13>K:\
    'K:\' is not recognized as an internal or external command,
    operable program or batch file.

    C:\Users\Davor13>k:\
    'k:\' is not recognized as an internal or external command,
    operable program or batch file.

    C:\Users\Davor13>K;
    'K' is not recognized as an internal or external command,
    operable program or batch file.

    C:\Users\Davor13>K:

    K:\>cd Semester 2\Java_Programming\Lab_01\dist

    K:\Semester 2\Java_Programming\Lab_01\dist>java -jar Lab_01.jar
    Enter an integer:
    2



    thats all i get

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,166
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Not sure what to do next!

    Did you expect any more than that? The code has no more print statements.
    Do the program in small steps, one table at a time.
    Start with one of the tables and generate a line for that.
    Then add the next line etc until its done.