Results 1 to 16 of 16
  1. #1
    Ark3 is offline Member
    Join Date
    Jun 2014
    Posts
    59
    Rep Power
    0

    Cool I Need Guidance to my Class Program... (Norm, If you are out there, I need help!!)

    My program is supposed to (When all classes are made), prompt User for a laughing syllable (Exp. ha)... then display HAHA,
    if they input "yuk", it displays YUKYUK. In addition, If they want, inputing nothing will give them the original: HAHA.
    Here is my code so far...

    Java Code:
    package loudLaugh;
    
    public class Laugh {
    	
    	String laughSound = "haha";
    	public Laugh(String theInput) {
    		laughSound = theInput;
    	}
    	public void Laugh1() {
    		System.out.println(laughSound);
    	}
    	public void loudLaugh1() {
    		System.out.println(laughSound.toUpperCase());
    	}
    }
    I need guidance on how to create this (hard for me(Beginner)) program.

    Thanks in Advanced,
    Sam.

    P.S. If it is Norm that helps me, I would just like to thank you for the billionth time for
    helping me so much...

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,041
    Rep Power
    10

    Default Re: I Need Guidance to my Class Program... (Norm, If you are out there, I need help!!

    Which part of this is giving you trouble? What specifically are you confused about? I don't see anywhere in your code that asks the user for input. I don't even see a main method. What is the smallest thing you know you have to do? Do it next.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Ark3 is offline Member
    Join Date
    Jun 2014
    Posts
    59
    Rep Power
    0

    Default Re: I Need Guidance to my Class Program... (Norm, If you are out there, I need help!!

    That's just the default laugh if the user inputs nothing.
    Keep in mind, the inputreader and buffered reader stuff are planned for later.
    Yet, I feel really incapable and don't know how to start.
    I do know how to prompt input, but how would I make it UpperCase, then
    ad another segment to form lets say: HAHA...

  4. #4
    Ark3 is offline Member
    Join Date
    Jun 2014
    Posts
    59
    Rep Power
    0

    Default Re: I Need Guidance to my Class Program... (Norm, If you are out there, I need help!!

    I am just starting to touch on Parameters and Overloading, I really don't know much about the two

  5. #5
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,783
    Blog Entries
    7
    Rep Power
    21

    Default Re: I Need Guidance to my Class Program... (Norm, If you are out there, I need help!!

    Sorry, Norm is having a day off; he's gone, fishing ...

    kind regards,

    Jos

    ps. have a look at the toUpperCase() and isEmpty() methods in the String class.
    cenosillicaphobia: the fear for an empty beer glass

  6. #6
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,041
    Rep Power
    10

    Default Re: I Need Guidance to my Class Program... (Norm, If you are out there, I need help!!

    Break your problem down into smaller pieces.

    Can you create a program that reads in a value from the user, saves it to a variable, then simply prints that variable back out to the console?

    When you get that working, can you create a program that converts the variable to all upper-case? You might consult the API for the String and Character classes for useful functions.

    When you get that working, can you create a program that accomplishes your assignment?
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  7. #7
    Ark3 is offline Member
    Join Date
    Jun 2014
    Posts
    59
    Rep Power
    0

    Default Re: I Need Guidance to my Class Program... (Norm, If you are out there, I need help!!

    I do know that that's what I'm going to use for this program.
    Second of all, How do I set the string variables?
    and How do I incorporate all the classes into one
    Main class, (keep in mind all the processes are methods).

  8. #8
    Ark3 is offline Member
    Join Date
    Jun 2014
    Posts
    59
    Rep Power
    0

    Default Re: I Need Guidance to my Class Program... (Norm, If you are out there, I need help!!

    I can: (List)
    - ask for file name through input, and then create a duplicate file, with the original file's content...
    -I can Create simple Applets
    -I am very familiar with Input...
    -I know a little about defining classes.
    -I can use Strings very well.

  9. #9
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,041
    Rep Power
    10

    Default Re: I Need Guidance to my Class Program... (Norm, If you are out there, I need help!!

    Which step in my above list are you stuck on then? What have you got so far? Please post the updated code, and we'll go from there.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  10. #10
    Ark3 is offline Member
    Join Date
    Jun 2014
    Posts
    59
    Rep Power
    0

    Default Re: I Need Guidance to my Class Program... (Norm, If you are out there, I need help!!

    The step I'm stuck is: how to, after asking for input (yuk), make it into YUKYUK?
    How do I use the input?

  11. #11
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,041
    Rep Power
    10

    Default Re: I Need Guidance to my Class Program... (Norm, If you are out there, I need help!!

    Check out the API for the String and Character classes, like JosAH and I said.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  12. #12
    Ark3 is offline Member
    Join Date
    Jun 2014
    Posts
    59
    Rep Power
    0

    Default Re: I Need Guidance to my Class Program... (Norm, If you are out there, I need help!!

    I'm typing it up to where the input is asked, then I'll post the code for you to tell me what
    to add onto it.

  13. #13
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,041
    Rep Power
    10

    Default Re: I Need Guidance to my Class Program... (Norm, If you are out there, I need help!!

    We aren't just going to tell you what to type. You have to check out the API for the String class and do some reading. It's less reading than this thread- in fact, it's less reading than this message. Reading the API should be your first step for problems like this, so it's a good habit to get into early.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  14. #14
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,365
    Rep Power
    6

    Default Re: I Need Guidance to my Class Program... (Norm, If you are out there, I need help!!

    I see a point of possible confusion here.

    - turning "yuk" into "yukyuk" needs no method of String at all; someone who "can use strings very well" should know that
    - making it all uppercase however might be easier to do if you find some sort of method to do it for you and String might just be the place to look for one

    *moves back into the shadows*
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  15. #15
    Ark3 is offline Member
    Join Date
    Jun 2014
    Posts
    59
    Rep Power
    0

    Default Re: I Need Guidance to my Class Program... (Norm, If you are out there, I need help!!

    KevinWorkman,
    I've done my program, except it's not the format I want it in, it's the format I'm capable of...

    Java Code:
    package loudLaugh;
    
    import java.io.BufferedReader;
    import java.io.InputStreamReader;
    
    public class useLaugh {
    	public static void main(String[] args) throws Exception {
    		InputStreamReader	isr;
    		BufferedReader		keyBoard;
    		String				inputLine;
    		isr = new InputStreamReader(System.in);
    		keyBoard = new BufferedReader(isr);
    		System.out.println("Please enter the Laughing Syllable...");
    		System.out.flush();
    		inputLine = keyBoard.readLine();
    		
    		Laugh laugh = new Laugh();
    		if(inputLine.trim().length() == 0){
    			laugh.laugh1();
    		}else{
    			laugh = new Laugh(inputLine);
    			System.out.print(inputLine.toUpperCase());
    			System.out.println(inputLine.toUpperCase());
    		}
    		keyBoard.close();
    		isr.close();
    		
    	}
    }
    I wanted the program to use multiple classes, and instance variables...
    How should I do that??
    Please give me a walkthrough.

  16. #16
    Ark3 is offline Member
    Join Date
    Jun 2014
    Posts
    59
    Rep Power
    0

    Default Re: I Need Guidance to my Class Program... (Norm, If you are out there, I need help!!

    Never mind, Dad helped me...
    But thanks every one for the unwavering support
    GODLIKE!!!!

Similar Threads

  1. Shoutout to Norm (moderator)
    By gnarkill10 in forum Suggestions & Feedback
    Replies: 0
    Last Post: 08-04-2012, 06:21 PM
  2. Need some Guidance with SOA
    By Arukas in forum New To Java
    Replies: 1
    Last Post: 02-22-2012, 10:45 AM
  3. Norm!! I got the loop to work!
    By louiedogg418 in forum New To Java
    Replies: 2
    Last Post: 07-05-2011, 11:19 PM
  4. What happened to Norm
    By Fubarable in forum Forum Lobby
    Replies: 2
    Last Post: 04-30-2009, 05:26 AM

Posting Permissions

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