Results 1 to 17 of 17
  1. #1
    w0ooop is offline Member
    Join Date
    Feb 2013
    Posts
    11
    Rep Power
    0

    Default how to do these program letters with values

    create a program that will perform the following operation
    1. accept 1-5 letters.
    2. each letter corresponds to a number.
    3. generates the sum of the numbers selected.
    4.displays the average of the numbers selected.

    values of letter A=20 B=4 C=7 D=9 E=10 F=15 O=6 U=12 S=12
    .. joption o scanner only can be use
    need it badly asap

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

    Default Re: how to do these program letters with values

    What have you done so far? Nobody will do your homework for you. Start yourself and ask specific questions when you get stuck.
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  3. #3
    w0ooop is offline Member
    Join Date
    Feb 2013
    Posts
    11
    Rep Power
    0

    Default Re: how to do these program letters with values

    nope i know..im stuck with how should the operation should be..... im having trouble with question 3 and 4 how should i do the mathematical equation 1 by 1???

  4. #4
    w0ooop is offline Member
    Join Date
    Feb 2013
    Posts
    11
    Rep Power
    0

    Default Re: how to do these program letters with values

    i use int to specify the equivalent of a letter like int A = 20; or i should use char??

  5. #5
    w0ooop is offline Member
    Join Date
    Feb 2013
    Posts
    11
    Rep Power
    0

    Default Re: how to do these program letters with values

    should i do that like q = a+ b; q = a + c ?

  6. #6
    w0ooop is offline Member
    Join Date
    Feb 2013
    Posts
    11
    Rep Power
    0

    Default Re: how to do these program letters with values

    public static void main(String[] args) {
    int A = 20,B = 4,C=7,D = 9, E = 10, F = 15, O = 6, U = 12, S = 12;
    int q;

    Scanner scan = new Scanner(System.in);

    System.out.println("Choose 2-5 letter from A,B,C,D,E,F,O,U,S");
    q= scan.nextInt();

    q = A + B;
    q = A + C;
    System.out.println("the sum of the enter letter is:"+q);

    should i continue this kind of equation??

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

    Default Re: how to do these program letters with values

    scan.nextInt() won't help you here, as the user enters a String. Read the String and make sure it has the correct length and contains only valid characters. If it doesn't match the requirements prompt the user to reenter.
    When you're done with that part you can start thinking about converting the input. One after the other, always break down the task into small bits.
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  8. #8
    w0ooop is offline Member
    Join Date
    Feb 2013
    Posts
    11
    Rep Power
    0

    Default Re: how to do these program letters with values

    what should i put q = ?? ishould use loop??

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

    Default Re: how to do these program letters with values

    Forget about ints! Just make sure you can read and verify the user input. Ints come later.
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  10. #10
    w0ooop is offline Member
    Join Date
    Feb 2013
    Posts
    11
    Rep Power
    0

    Default Re: how to do these program letters with values

    how should i do to recognize the letter i type?

  11. #11
    w0ooop is offline Member
    Join Date
    Feb 2013
    Posts
    11
    Rep Power
    0

    Default Re: how to do these program letters with values

    how should the letter could be recognize?? public static void main(String[] args) {
    int A = 20,B = 4,C=7,D = 9, E = 10, F = 15, O = 6, U = 12, S = 12;
    int sum,letters=0,q,w;

    Scanner scan = new Scanner(System.in);

    System.out.println("Choose 2-5 letter from A,B,C,D,E,F,O,U,S");
    q = scan.nextInt () ;
    System.out.println("Choose 2-5 letter from A,B,C,D,E,F,O,U,S");
    w = scan.nextInt () ;
    if (letters<2);

    sum = q + w;
    System.out.println("the sum of the letters is:"+sum);

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

    Default Re: how to do these program letters with values

    Man, keep it simple! You cannot ever read any input from the user as is. One step after the other. Just read any input and print it to the console. After that you can think about validation.
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  13. #13
    w0ooop is offline Member
    Join Date
    Feb 2013
    Posts
    11
    Rep Power
    0

    Default Re: how to do these program letters with values

    i couldnt understand what should ill do to recognize the value of the letter??

  14. #14
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default Re: how to do these program letters with values

    Listen to what PhHein is saying.
    You are jumping ahead of yourself.

    Software development is about breaking the task in front of you down to the smallest steps.
    It is being suggested to you to start with the simple step of reading input from the console into a String variable and output it back to the screen to check it is doing it correctly.

    Once you have that code you can then start to look at turning it into numbers.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  15. #15
    w0ooop is offline Member
    Join Date
    Feb 2013
    Posts
    11
    Rep Power
    0

    Default Re: how to do these program letters with values

    so ishould have string sorry im just new to programming... im not that knowledgeble about it..

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

    Default Re: how to do these program letters with values

    Yes, use a String as input.
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  17. #17
    w0ooop is offline Member
    Join Date
    Feb 2013
    Posts
    11
    Rep Power
    0

    Default Re: how to do these program letters with values

    i dont know how to make it I surrender shit... time to rest hope i had some help how should do it right but thanks to all of you... i hope i can improve on it

Similar Threads

  1. Replies: 2
    Last Post: 02-06-2013, 07:48 AM
  2. Convert English letters to Tamil letters
    By srinivasmallabathula in forum New To Java
    Replies: 1
    Last Post: 10-20-2012, 03:39 PM
  3. Help needed in Passing values to another program.
    By Kuttappu in forum New To Java
    Replies: 3
    Last Post: 05-28-2012, 07:28 PM
  4. Replies: 13
    Last Post: 05-27-2011, 11:48 AM
  5. Replies: 2
    Last Post: 04-09-2009, 11:46 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
  •