Main Blog Directory

Something Cool

Write a method, getSecondLine, that is passed a String argument and that returns the second line, without its newline character.

Write a method, getSecondLine, that is passed a String argument and that returns the second line, without its newline character.

LANGUAGE: Java CHALLENGE: Write a method, getSecondLine, that is passed a String argument and that returns the second line, without its newline character. (Recall that lines are terminated with the “\n” character .) Assume that the argument contains at least two complete, newline-terminated lines.

Read More

Write a method, makeEmailAddress, that is passed two String arguments: the first is a username, like “leadbelly” and the second is a domain name, like “blues.com”.

Write a method, makeEmailAddress, that is passed two String arguments: the first is a username, like “leadbelly” and the second is a domain name, like “blues.com”.

LANGUAGE: Java CHALLENGE: Write a method, makeEmailAddress, that is passed two String arguments: the first is a username, like “leadbelly” and the second is a domain name, like “blues.com”. The method returns an email address formed from joining these with an “@”: “leadbelly@blues.com”.

Read More

Write a method, getEmailDomain, that is passed a String argument that is an email address and returns the domain name part. So if “mozart@salzberg.de” is passed, the method returns “salzberg.de”.

Write a method, getEmailDomain, that is passed a String argument that is an email address and returns the domain name part.  So if “mozart@salzberg.de” is passed, the method returns “salzberg.de”.

LANGUAGE: Java CHALLENGE: Write a method, getEmailDomain, that is passed a String argument that is an email address and returns the domain name part. So if “mozart@salzberg.de” is passed, the method returns “salzberg.de”. Assume that the argument will always be a correctly formatted email address.

Read More

Write a method, getEmailUserName, that is passed a String argument that is an email address and returns the user-name part.

Write a method, getEmailUserName, that is passed a String argument that is an email address and returns the user-name part.

LANGUAGE: Java CHALLENGE: Write a method, getEmailUserName, that is passed a String argument that is an email address and returns the user-name part. So if “mozart@salzberg.de” is passed, the method returns “mozart”. Assume that the argument will always be a correctly formatted email address.

Read More

Write a method, makeSubjectLine, that gets a String argument and returns the same String but with “Subject: ” in front of it. So if the argument is “Are you going to the show?” the method returns “Subject: Are you going to the show?”.

Write a method, makeSubjectLine, that gets a String argument and returns the same String but with “Subject: ” in front of it. So if the argument is “Are you going to the show?” the method returns “Subject: Are you going to the show?”.

LANGUAGE: Java CHALLENGE: Write a method, makeSubjectLine, that gets a String argument and returns the same String but with “Subject: ” in front of it. So if the argument is “Are you going to the show?” the method returns “Subject: Are you going to the show?”.

Read More

Write a statement that declares a prototype for a function divide that takes four arguments and returns no value.

Write a statement that declares a prototype for a function divide that takes four arguments and returns no value.

LANGUAGE: C++ CHALLENGE: Write a statement that declares a prototype for a function divide that takes four arguments and returns no value. The first two arguments are of type int. The last two arguments arguments are pointers to int that are set by the function to the quotient and remainder of dividing the first argument […]

Read More