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 6 of 6

Thread: array+functions

  1. #1
    Junior Member
    Join Date
    Mar 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default array+functions

    could you help me to solve it Q; Write a function printStarts(int n). Write a loop from 1 to n and print stars in single line.

  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,290
    My Mood
    Hungover
    Thanks
    142
    Thanked 620 Times in 531 Posts

    Default Re: array+functions

    What have you tried? Where are you stuck?
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    4,783
    My Mood
    Mellow
    Thanks
    175
    Thanked 625 Times in 612 Posts

    Default Re: array+functions

    Welcome to the forum! Please read this topic to learn how to post code correctly and other useful info for new members.

  4. #4
    Junior Member
    Join Date
    May 2014
    Location
    manila, philippines
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: array+functions

    here's the algorithm+pseudocode that might help you solve this (am just saying, "instruction in plain english")

    1) write name of function (must accept an integer as parameter)
    2) start a loop using "for"
    3) from 1 to "whatever the integer parameter"...loop.... until current count is equal to "whatever the integer parameter"....increment count as you go
    4) for every loop....print a star

    here's the code.

     
    public void printStars(int numberOfStarsToPrint){
     
    //you might want to validate the parameter here (optional for you)
     
    // GB: solution removed
     
    }
     
    }

  5. #5
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    4,783
    My Mood
    Mellow
    Thanks
    175
    Thanked 625 Times in 612 Posts

    Default Re: array+functions

    @johnbee: please review The Problem with Spoon-feeding.

  6. #6
    Junior Member
    Join Date
    May 2014
    Location
    manila, philippines
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: array+functions

    sorry and thank you.

Similar Threads

  1. [SOLVED] Deprecated functions
    By dicdic in forum Java Theory & Questions
    Replies: 3
    Last Post: December 15th, 2013, 07:11 PM
  2. Using functions in a calculator
    By aesguitar in forum Java Theory & Questions
    Replies: 9
    Last Post: November 17th, 2013, 09:54 AM
  3. How this GUI functions
    By mathobject in forum Java Programming Tutorials
    Replies: 3
    Last Post: October 15th, 2012, 08:10 AM
  4. Hash Functions
    By Blueshark in forum Java Theory & Questions
    Replies: 3
    Last Post: July 2nd, 2012, 03:04 PM
  5. need help with using trig functions
    By Tdogg in forum What's Wrong With My Code?
    Replies: 3
    Last Post: July 1st, 2012, 06:47 AM