Results 1 to 6 of 6

Thread: Console

  1. #1
    Paus34 is offline Member
    Join Date
    Mar 2013
    Posts
    16
    Rep Power
    0

    Default Console

    This is some college work i have but no idea how to do it
    First post as well

    Create a console application with the following classes: Main, User (Java bean) and Printer.
     User:
    Attributes: name, surname, num
    Methods: gets and sets
    Constructor: Set any default values to the attributes.
    Overloaded constructor:
    Parameters: name, surname, num

     Printer Class:
    Overloaded constructor:
    Parameter: Generic ArrayList
    Methods: processInfo() and calculateLuckyNum()

    processInfo(): Using a Thread, print each letter of each user’s name separated by a space, then print the other information (Use the calculateLuckyNum() to calculate the number) after that. Eg. Name: L a d y Gaga 48

    calculateLuckyNum(): This method should use the sum of the length of the user’s name and the num entered and return it as a string to the calling method.

     Main class:
    Input 3 arguments from the console. From the main method create an instance of the Main class and parse the args[] array to the overloaded constructor. Working from the overloaded constructor, test if there are any values entered into the args[] array, if not, throw a custom exception and exit the program. If there is no error, create an instance of the User class and using set methods, send all the array’s information to the User bean. Using the User’s overloaded constructor, add the following information to create another bean:
    Name: “Lady”
    Surname: “Gaga”
    Num: “9”
    Add these two created beans to a Generic ArrayList of User beans and send the ArrayList to the Printer class using an overloaded constructor. After the constructor has been called, call the processInfo() method in the Printer class using the instance created.

  2. #2
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

    Default Re: Console

    What have you done? Where are you stuck? Nobody will do it for you. Post your best attempt and ask specific questions.
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  3. #3
    Paus34 is offline Member
    Join Date
    Mar 2013
    Posts
    16
    Rep Power
    0

    Default Re: Console

    i dont want anybody to do it for me...im stuck with parse the 3 arguments to the args array and " parse the args[] array to the overloaded constructor''

  4. #4
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

    Default Re: Console

    Ok, show your code and tell us what goes wrong.
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  5. #5
    Paus34 is offline Member
    Join Date
    Mar 2013
    Posts
    16
    Rep Power
    0

    Default Re: Console

    i dont have much code really to show i just dont understand the question they are asking me

  6. #6
    wsaryada is offline Senior Member
    Join Date
    Jun 2007
    Location
    Bali, Indonesia
    Posts
    757
    Rep Power
    8

    Default Re: Console

    To create an instance of a class you'll need a constructor. When you don't define any it will have a default constructor that takes no argument. When you add another constructor that accept argument you'll have an overloaded constructor. In your example the Main class might look something like this:

    Java Code:
    public class Main {
        public Main() {
        }
    
        public Main(String[] args) {
            // Parse the args array. Throw exception if it doesn't follow the specification.
        }
    
        public static void main(String[] args) {
            Main main = new Main(args);
        }
    }

Similar Threads

  1. Help with Console
    By thiagohe in forum Advanced Java
    Replies: 7
    Last Post: 08-01-2011, 01:30 PM
  2. Java Console
    By stiwi in forum Java Software
    Replies: 4
    Last Post: 05-19-2010, 02:53 PM
  3. Console in NetBeans
    By Anaconda in forum New To Java
    Replies: 6
    Last Post: 12-31-2009, 02:14 AM
  4. How Do You?? Get the Console Output as a GUI??
    By Lyricid in forum AWT / Swing
    Replies: 10
    Last Post: 11-20-2009, 11:35 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •