Results 1 to 17 of 17
- 02-20-2013, 12:49 PM #1
Member
- Join Date
- Feb 2013
- Posts
- 11
- Rep Power
- 0
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
- 02-20-2013, 12:54 PM #2
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
- 02-20-2013, 12:58 PM #3
Member
- Join Date
- Feb 2013
- Posts
- 11
- Rep Power
- 0
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???
- 02-20-2013, 12:59 PM #4
Member
- Join Date
- Feb 2013
- Posts
- 11
- Rep Power
- 0
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??
- 02-20-2013, 01:01 PM #5
Member
- Join Date
- Feb 2013
- Posts
- 11
- Rep Power
- 0
Re: how to do these program letters with values
should i do that like q = a+ b; q = a + c ?
- 02-20-2013, 01:11 PM #6
Member
- Join Date
- Feb 2013
- Posts
- 11
- Rep Power
- 0
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??
- 02-20-2013, 01:26 PM #7
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
- 02-20-2013, 01:41 PM #8
Member
- Join Date
- Feb 2013
- Posts
- 11
- Rep Power
- 0
Re: how to do these program letters with values
what should i put q = ?? ishould use loop??
- 02-20-2013, 01:46 PM #9
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
- 02-20-2013, 02:14 PM #10
Member
- Join Date
- Feb 2013
- Posts
- 11
- Rep Power
- 0
Re: how to do these program letters with values
how should i do to recognize the letter i type?
- 02-20-2013, 02:18 PM #11
Member
- Join Date
- Feb 2013
- Posts
- 11
- Rep Power
- 0
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);
- 02-20-2013, 02:22 PM #12
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
- 02-20-2013, 02:49 PM #13
Member
- Join Date
- Feb 2013
- Posts
- 11
- Rep Power
- 0
Re: how to do these program letters with values
i couldnt understand what should ill do to recognize the value of the letter??
- 02-20-2013, 03:03 PM #14
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
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.
- 02-20-2013, 03:07 PM #15
Member
- Join Date
- Feb 2013
- Posts
- 11
- Rep Power
- 0
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..
- 02-20-2013, 03:26 PM #16
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
- 02-20-2013, 03:26 PM #17
Member
- Join Date
- Feb 2013
- Posts
- 11
- Rep Power
- 0
Similar Threads
-
how to get return values from a button to main program.
By dinu in forum AWT / SwingReplies: 2Last Post: 02-06-2013, 06:48 AM -
Convert English letters to Tamil letters
By srinivasmallabathula in forum New To JavaReplies: 1Last Post: 10-20-2012, 02:39 PM -
Help needed in Passing values to another program.
By Kuttappu in forum New To JavaReplies: 3Last Post: 05-28-2012, 06:28 PM -
Building an inventory program that uses an array but has string values as well as int
By Beaner462 in forum New To JavaReplies: 13Last Post: 05-27-2011, 10:48 AM -
Need help with a program that takes letters and then dumps them back out
By Adde1986 in forum New To JavaReplies: 2Last Post: 04-09-2009, 10:46 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks