Author |
Message |
ryanisilly
|
Posted: Fri Feb 13, 2015 10:59 am Post subject: Three Letter Acronyms |
|
|
Hi guys, I'm in an intro comp sci class and been trying to do this problem for hours.
If anyone could give me some help on it, it would be really appreciated.[/img]
Description: |
|
Filesize: |
22.01 KB |
Viewed: |
451 Time(s) |
![comp1.png](uploads/attachments/thumbs/t_comp1_156.png)
|
Description: |
|
Filesize: |
80.25 KB |
Viewed: |
276 Time(s) |
![Comp.png](uploads/attachments/thumbs/t_comp_106.png)
|
Description: |
|
Filesize: |
22.01 KB |
Viewed: |
232 Time(s) |
![comp1.png](uploads/attachments/thumbs/t_comp1_130.png)
|
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Insectoid
![](http://compsci.ca/v3/uploads/user_avatars/13760332514cbd0ce972eaa.jpg)
|
Posted: Fri Feb 13, 2015 11:06 am Post subject: RE:Three Letter Acronyms |
|
|
What have you tried so far?
|
|
|
|
|
![](images/spacer.gif) |
ryanisilly
|
Posted: Fri Feb 13, 2015 11:31 am Post subject: RE:Three Letter Acronyms |
|
|
My main problem is just that I have no idea how to write my own method that does #2. I've missed some classes and all of question #2 is foreign language to me.
|
|
|
|
|
![](images/spacer.gif) |
Insectoid
![](http://compsci.ca/v3/uploads/user_avatars/13760332514cbd0ce972eaa.jpg)
|
Posted: Fri Feb 13, 2015 12:04 pm Post subject: RE:Three Letter Acronyms |
|
|
Do you know how to write a method? Do you know what a boolean is? What about a char?
|
|
|
|
|
![](images/spacer.gif) |
ryanisilly
|
Posted: Fri Feb 13, 2015 12:20 pm Post subject: RE:Three Letter Acronyms |
|
|
I think so, would it look something like this?
private static void isUpperLetter(
|
|
|
|
|
![](images/spacer.gif) |
Insectoid
![](http://compsci.ca/v3/uploads/user_avatars/13760332514cbd0ce972eaa.jpg)
|
Posted: Fri Feb 13, 2015 12:22 pm Post subject: RE:Three Letter Acronyms |
|
|
Well that's the first part of it. You want it to return a boolean though, not void.
|
|
|
|
|
![](images/spacer.gif) |
ryanisilly
|
Posted: Fri Feb 13, 2015 12:35 pm Post subject: RE:Three Letter Acronyms |
|
|
Sooo something like this then?
private static return isUpperLetter(
From there I have no idea.
|
|
|
|
|
![](images/spacer.gif) |
DemonWasp
|
Posted: Fri Feb 13, 2015 3:24 pm Post subject: RE:Three Letter Acronyms |
|
|
For now, you want to declare functions using this template:
private static returnType functionName ( arguments )
For a function like isUpperCase or isTLA, the return type would be boolean -- either true or false, but no other values.
Since your function has a return type (other than void), you must make sure that the function eventually hits a return statement, and that the value you return is of the same type as the declared return type of the function.
Start with this:
code: |
private static boolean isTLA ( String input ) {
return true;
}
|
Once you get your program compiling, you can replace the "return true;" line with something that actually checks the requirements from your assignment (has exactly three letters, and all three are upper case, etc).
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
|