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

Thread: Help in programming question. Bluej complier

  1. #1
    Junior Member
    Join Date
    Aug 2011
    Posts
    18
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default Help in programming question. Bluej complier

    Hi guys,

    I desperately need help in these questions:


    Write an application to: Print the cost of 25 boxes of apples. Each box of apples costs #12.17 The answer to be of the form:
    The cost of the apples is #xxx

    Write an application that takes as a command line argument a word and outputs how many character are in the word. If called with the command line arguments Computingand Freedomwould output: Computing has 9 characters Freedom has 7 characters

    Write an application that takes as a command line argument a word and outputs how many vowels are in the word. A vowel is the letter a, e, i, o or u. If called with the command line arguments Computingand Freedomwould output: Computing has 3 vowels Freedom has 3 vowels


    Write an application that takes as a command line argument a word and checks if it is a palindrome. A palindrome is a word which when written backwards is the same as when written normally. For example: civic and redder are palindromes. If called with command line arguments civicand historywould output civic is a palindrome history is not a palindrome


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

    Default Re: Help in programming question. Bluej complier

    Where are your questions? All I see are your assignment requirements.
    Take them one at a time. Don't post more than one problem on one thread.
    Be sure to show what you have done and ask questions about what you are having problems with.

  3. The Following User Says Thank You to Norm For This Useful Post:

    Rads23 (August 3rd, 2011)

  4. #3
    Junior Member
    Join Date
    Aug 2011
    Posts
    18
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default Re: Help in programming question. Bluej complier

    Hi Norm,

    Thanks for your reply.

    Okay one of the questions is :

    1) Write an application to: Print the cost of 25 boxes of apples. Each box of apples costs #12.17 The answer to be of the form:
    The cost of the apples is #xxx

    I haven't done anything on this as I dont know how to do it.. thats basically the problem.

    Thank You.

    Rads

  5. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Help in programming question. Bluej complier

    Start simply. Write a program that prints:
    The cost of the apples is #xxx
    Where xxx is a number in a variable.

    When you have that move on to the next part.

  6. The Following User Says Thank You to Norm For This Useful Post:

    Rads23 (August 3rd, 2011)

  7. #5
    Junior Member
    Join Date
    Aug 2011
    Posts
    18
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default Re: Help in programming question. Bluej complier

    Oh so basically,

    public class apples{
    public static void main(String[]args) {
    system.out.printIn("The cost of the apples is #318.75")
    }
    } //end of class apples


    is that correct or am i completely wrong lol?

    R x

  8. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Help in programming question. Bluej complier

    Where xxx is a number in a variable.
    Put the 318.75 into a double variable and use that in the println

    Also classnames should begin with a Capital letter

  9. #7
    Junior Member
    Join Date
    Aug 2011
    Posts
    18
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default Re: Help in programming question. Bluej complier

    As you can tell im not really good at Java, so im really confused...

    could you give me an example as in what you mean please?

    R x

  10. #8
    Junior Member
    Join Date
    Aug 2011
    Posts
    18
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default Re: Help in programming question. Bluej complier

    [QUOTE=Norm;38758]Put the 318.75 into a double variable and use that in the println

    Sorry, could u explain what that means?

  11. #9
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Help in programming question. Bluej complier

    var = 123.45;
    System.out.println("some text " + var);

  12. #10
    Junior Member
    Join Date
    Aug 2011
    Posts
    18
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default Re: Help in programming question. Bluej complier

    it doesnt work,
    i need to ask something else to the variable.

    my coding i did was:

    public class apples{
    public static void main(String[]args) {
    var= 3.18.75;
    system.out.printIn("The cost of the apples is + 318.75");
    }
    } //end of class apples


    you probably think im stupid for asking you all these stupid questions.... what am i doing wrong, whats the right coding?

    thanks! R x

  13. #11
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Help in programming question. Bluej complier

    Time for you to look at the Tutorials or your textbook. I'm not going to give you lines of code. You need to look at some programs and see how they are put together.

    My example:
    System.out.println("some text " + var);

    your version:
    system.out.printIn("The cost of the apples is + 318.75");

    How many differences do you see between mine and yours?
    Other than I said some text
    instead of The cost of the apples is

  14. #12
    Junior Member
    Join Date
    Aug 2011
    Posts
    18
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default Re: Help in programming question. Bluej complier

    but its so hard

  15. #13
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Help in programming question. Bluej complier

    That could be. Some things are harder than others. I have a hard time learning to play music.
    Spend more time reading the Tutorials:
    The Java™ Tutorials
    Trail: Learning the Java Language: Table of Contents (The Java™ Tutorials)
    The Really Big Index

Similar Threads

  1. Replies: 7
    Last Post: July 21st, 2011, 02:29 PM
  2. Hi everybody, im new to programming.
    By Sauliux in forum Member Introductions
    Replies: 1
    Last Post: March 5th, 2011, 12:06 PM
  3. [SOLVED] New to Programming
    By Delacratic in forum What's Wrong With My Code?
    Replies: 7
    Last Post: February 8th, 2011, 02:45 PM
  4. Complier not working
    By Benderman in forum The Cafe
    Replies: 3
    Last Post: January 9th, 2011, 06:05 PM
  5. New to programming
    By Milanocookies56@gmail.com in forum What's Wrong With My Code?
    Replies: 5
    Last Post: March 31st, 2010, 09:55 AM