I really need help with this so if anyone can help me out that wouldbe really great of you.

Discussion in 'Java' started by adityagaddam90, Feb 6, 2008.

  1. I am a student studying in college this is my first year and i am
    taking Computer Science as my Major but i am having a hard time with
    my course. I have no idea of whats going on in class so if any 1 knows
    anything about this things i have to do please help me out.

    the professor gave us this to do and i am having some trouble with
    this so plz help me out on what to do here.

    Part I

    Write a program that prints the following pattern:

    *
    ***
    *****
    *******
    *****
    ***
    *

    Part II

    To make a profit a local store marks up the prices of its items by
    25%. Write a Java program that declares the following variables:
    1. a double variable named percent_markedup
    2. a double variable named original_price
    3. a double variable named sales_tax_rate


    In your program be sure to assign a value to each of the variables 1-3
    above. Use initialization for 1 and 2 and for 3.

    Using the information from above, the program should then output:
    1. the original price of the item
    2. the marked-up percentage of the item (original price times percent
    of markup)
    3. the store's selling price of the item
    4. the sales tax rate
    5. the sales tax
    6. the final price of the item (the final price of the item is the
    selling price plus the sales tax)



    can u send me an email or using this to communicate. My email is
    . thx a lot
     
    adityagaddam90, Feb 6, 2008
    #1
    1. Advertisements

  2. See http://home.earthlink.net/~patricia_shanahan/beginner.html for my
    advice on this situation.

    Patricia
     
    Patricia Shanahan, Feb 6, 2008
    #2
    1. Advertisements

  3. No this is not a helpdesk, it is a public forum.
    And can you please take more effort to spell words fully?
    'You have spam!' It is best not to post your email
    address clearly on the internet, but I suppose for a
    GG poster, it makes little difference.
     
    Andrew Thompson, Feb 6, 2008
    #3
  4. adityagaddam90

    Mark Space Guest

    I'm just curious: is this your first programming class ever or are you
    taking a second or later course now?

    Patricia gave pretty good advice. The only things I would add are:

    1. Talk to your professor during office hours, or just before or just
    after class. You may not be the only one having these problems.

    2. Go to your computer lab and ask the assistants. Often, that's why
    they are there. If not (they can't or won't help you), try to find out
    if there's a lab with assistants who are available for instruction.
     
    Mark Space, Feb 6, 2008
    #4
  5. adityagaddam90

    Daniel Pitts Guest

    My suggestion to you is to post what you've already tried, and what went
    wrong with it. We won't do your homework for you here, but many of us
    will help you understand it and make it happen.
     
    Daniel Pitts, Feb 6, 2008
    #5
  6. yes this is my first programming class ever.
     
    adityagaddam90, Feb 6, 2008
    #6
  7. hey Daniel like you have said i tried doing this for part 1 and i
    didnt get it right so can u tell me what i have done wrong here.

    public class Stars
    {
    public static void main(string [] args)
    {
    System.out.println( * );
    System.out.println( *** );
    System.out.println( ***** );
    System.out.println(*******);
    System.out.println( ***** );
    System.out.println( *** );
    System.out.println( * );
    }
    }
     
    adityagaddam90, Feb 6, 2008
    #7
  8. adityagaddam90

    Stefan Ram Guest

    public class Main
    { public static void main( final java.lang.String[] args )
    { java.lang.System.out.println
    ( java.lang.String.format
    ( "%15.0f\n%16.1f\n%17.3f\n%18.5f\n%17.3f\n%16.1f\n%15.0f\n",
    0., 0., 0., 0., 0., 0., 0. ).replaceAll( "\\S", "*" )); }}

    *
    ***
    *****
    *******
    *****
    ***
    *
     
    Stefan Ram, Feb 6, 2008
    #8
  9. This seems just a little bit more subtle in its use of advanced features
    than I would recommend for the OP's current situation.

    Patricia
     
    Patricia Shanahan, Feb 6, 2008
    #9
  10. String literals in Java are enclosed in " marks:

    System.out.println("Some string");

    Patricia
     
    Patricia Shanahan, Feb 6, 2008
    #10
  11. thank you i will try that and see if it works
     
    adityagaddam90, Feb 6, 2008
    #11
  12. adityagaddam90

    Lew Guest

    Not just the assistants. If you have an on-campus lab, just hang out there.
    Take a look around for a few days. Stay low key. Pay attention to who else
    is there all the time. See who attracts advice-seekers, and how they react to
    supplicants.

    When you start asking questions in that room, don't start with the gurus. Ask
    the other supplicants - find out what they learned from the masters. Ask them
    how they plan to use their new-found wisdom. Ask them for advice with your
    problem.

    Yes, the other seekers. The masters will respect you more when you finally do
    approach them. Also, the insight of your fellow students who are at about the
    same stage as you is worth more than you might think, as will your own insight
    be when stimulated by your fellows.

    Don't be too shy about approaching the masters - if they didn't want to answer
    questions they'd hang out somewhere else.

    As to the "stars" problem, a popular one, it seems, forget programming at
    first and concentrate on logic. Look for repetitions, things that happen over
    and over again, perhaps with a different number of stars or spaces each time.
    It's much more important to understand the fundamental logic of the problem
    than how to program it.
     
    Lew, Feb 6, 2008
    #12
  13. Hey Patricia it worked thank you so much and all others who helped me
    too. I am having problem with the part 2 do you think you can help me
    out on how to start out with.

    Part II

    To make a profit a local store marks up the prices of its items by
    25%. Write a Java program that declares the following variables:
    1. a double variable named percent_markedup
    2. a double variable named original_price
    3. a double variable named sales_tax_rate


    In your program be sure to assign a value to each of the variables 1-3
    above. Use initialization for 1 and 2 and for 3.

    Using the information from above, the program should then output:
    1. the original price of the item
    2. the marked-up percentage of the item (original price times percent
    of markup)
    3. the store's selling price of the item
    4. the sales tax rate
    5. the sales tax
    6. the final price of the item (the final price of the item is the
    selling price plus the sales tax)
     
    adityagaddam90, Feb 6, 2008
    #13
  14. adityagaddam90

    Stefan Ram Guest

    Several years ago, I have created a web page with exercise
    regarding loops.

    First, pupils are supposed to draw a line,
    whose length is given as input to the program.

    An example for a run of the program is given as follows.

    length? 20

    ********************

    Next, I try to make them invent nesting of loops
    (which was not mentioned in the class so far):

    width? 17
    height? 4

    *****************
    *****************
    *****************
    *****************

    After some other exercises, comes exactly the same figure as
    in the OP, but with a »height« and width-change specified as
    input to the program at run time:

    height? 4
    increment? 1

    *
    ***
    *****
    *******
    *****
    ***
    *

    And the final exercise is an ellipse:

    half height? 11
    half width? 31

    ********************
    ********************************
    ****************************************
    **********************************************
    ****************************************************
    ******************************************************
    **********************************************************
    ************************************************************
    ************************************************************
    **************************************************************
    **************************************************************
    **************************************************************
    **************************************************************
    ************************************************************
    ************************************************************
    **********************************************************
    ******************************************************
    ****************************************************
    **********************************************
    ****************************************
    ********************************
    ********************

    This usually is too hard for the pupils at this level, but
    there sometimes might be pupils who are exceptionally gifted
    and want more difficult exercises.

    ( The URI of my German langauge with those exercises is as follows.

    http://www.purl.org/stefan_ram/pub/programmieren_aufgabe_iteration_de

    )
     
    Stefan Ram, Feb 6, 2008
    #14
  15. Work step-by-step through the instructions, doing each thing you are
    told to do. Pay attention to the other advice you have received about
    using your professor, teaching assistants etc.

    I can't help you directly with this, because you have given me nothing
    to go with.

    Patricia
     
    Patricia Shanahan, Feb 6, 2008
    #15
  16. ok well thx for at lest helping me out with something.
     
    adityagaddam90, Feb 6, 2008
    #16
  17. adityagaddam90

    Lew Guest

    How very gracious. Except for that "at least" part - it actually sounds
    rather sulky.

    You have received excellent advice, particularly from Patricia, who has given
    you the keys to excel in your course. I should think you'd be exulting with
    gratitude, most especially toward her.

    Please avoid textspeak in Usenet posts.
     
    Lew, Feb 6, 2008
    #17
  18. adityagaddam90

    Mark Space Guest

    *whoosh*

    And the point goes flying over your head, I'm sorry to have to say.

    These programs look a bit rough actually for a first class. Maybe
    there's some parts of the lecture that will discuss these issues still
    to come?

    The first part of Part II should be easy to get though, try to get at
    least that much.
     
    Mark Space, Feb 6, 2008
    #18
  19. Without any comment on why you wrote it that way, this is quite
    dangerous, me thinks. If the OP were to blindly copy and submit it (as
    many beginners are tempted to), (s)he is bound to get into trouble for
    it (if the tutors are worth their salt). Which just might discourage
    her/him, unnecessarily.

    /W
     
    Wildemar Wildenburger, Feb 6, 2008
    #19
  20. There is a long standing Usenet tradition of providing technically
    correct but obfuscated, advanced or otherwise "unlikely" solutions to
    homework questions.

    It's something the OP needs to deal with, and is IMO an important part
    of the learning process if he comes here with questions that show a
    complete lack of effort to solve the problem himself.

    /gordon

    --
     
    Gordon Beaton, Feb 6, 2008
    #20
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.