Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Three Letter Acronyms
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
ryanisilly




PostPosted: 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]



comp1.png
 Description:
 Filesize:  22.01 KB
 Viewed:  299 Time(s)

comp1.png



Comp.png
 Description:
 Filesize:  80.25 KB
 Viewed:  188 Time(s)

Comp.png



comp1.png
 Description:
 Filesize:  22.01 KB
 Viewed:  164 Time(s)

comp1.png


Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Fri Feb 13, 2015 11:06 am   Post subject: RE:Three Letter Acronyms

What have you tried so far?
ryanisilly




PostPosted: 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.
Insectoid




PostPosted: 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?
ryanisilly




PostPosted: 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(
Insectoid




PostPosted: 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.
ryanisilly




PostPosted: 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.
DemonWasp




PostPosted: 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).
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 8 Posts ]
Jump to:   


Style:  
Search: