The Artima Developer Community
Sponsored Link

Java Answers Forum
Solve this problem if you can

9 replies on 1 page. Most recent reply: Jul 27, 2005 9:33 PM by Matt Gerrans

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 9 replies on 1 page
ogeela

Posts: 5
Nickname: oggy
Registered: Jul, 2005

Solve this problem if you can Posted: Jul 19, 2005 2:38 AM
Reply to this message Reply
Advertisement
Consider the code:

public class Meth1{

public static Boolean words(String []p,String []q)

{
boolean flag =true;

if (p.length=q.length)
flag=false;

else

for (int i=0 ; i< p.length ; i++)

{
if (look(p,q))flag=false;
break;
}
return flag;

}//words


public static boolean look(String []p,String w)
{
boolen flag = true;
for (int i=0; i< p.length; i++)

if (p. equals(w))flag = false;

return flag;

}

}//Meth1




a) Work out and documentthe processes being carried out by the method "words" in the above class.
Your documentation should include any data used for the purpose.

b) a client has an array of English words. What is required to list all those words from the array,
which come alphabetically after the word "master", and they are to appear in alphabetical order.
For example: given an array of words as shown below:

cast static thread make void import

should produce an array of words:

static thread void

Use inheritance to extend the class "Meth1" to produce the necessary method


Kondwani Mkandawire

Posts: 530
Nickname: spike
Registered: Aug, 2004

Re: Solve this problem if you can Posted: Jul 19, 2005 3:34 AM
Reply to this message Reply
Could you *Please* indent your code!!
Use the pre tags. Most of us get discouraged
from reading messy code.

Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: Solve this problem if you can Posted: Jul 21, 2005 10:22 PM
Reply to this message Reply
You expect someone who doesn't ever try to do his own homework to read the forum posting tips?

baidongli

Posts: 2
Nickname: baidongli
Registered: Jul, 2005

Re: Solve this problem if you can Posted: Jul 21, 2005 11:29 PM
Reply to this message Reply
to ogeela
check this:
if (p.length=q.length)
replace the "=" symbol with "=="

Kondwani Mkandawire

Posts: 530
Nickname: spike
Registered: Aug, 2004

Re: Solve this problem if you can Posted: Jul 21, 2005 11:38 PM
Reply to this message Reply
I really think we should stop responding to the
OP's posts. He/she has no forum ettiquette
(if there is such a thing). He/she posts his
assignments, is extremely messy. After supplying
him/her with possible steps towards solutions
and requesting that he/she be abit considerate
and abide by the requested code format he/she
continues to simply just copy and paste the
code from whatever assignment web page his course
is located at to this forum.

Not to be rude, but personally I won't be responding
to any of his/her posts until the person makes
his posts a little bit easier on our eyes.

One,
Spike

ogeela

Posts: 5
Nickname: oggy
Registered: Jul, 2005

Re: Solve this problem if you can Posted: Jul 25, 2005 3:36 AM
Reply to this message Reply
sorry to cause you much probs but i got this questions from a friend and its was quite pale and i had to recopy it .
Thus i certainly makes some mistakes.
I will try to get the original.


Thanks

Ogeela

Kondwani Mkandawire

Posts: 530
Nickname: spike
Registered: Aug, 2004

Re: Solve this problem if you can Posted: Jul 25, 2005 6:10 AM
Reply to this message Reply
What does that have to do with taking two
minutes to indent your code and sticking
in the appropriate pre tags to make your
code a little more legible.

If we are able to take 5 minutes to read
your post, you should surely be able to
take two to ensure that your post is
presentable and some what legible.

Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: Solve this problem if you can Posted: Jul 25, 2005 8:58 AM
Reply to this message Reply
Yes, of course you just got this from "a friend." It was just something your "friend" was musing about and is not just a homework assignment typed in verbatim, of course.

You will learn a lot more by at least attempting to do your homework -- and when the test rolls around you won't be quite as clueless.

Sean McCullough

Posts: 3
Nickname: banksean
Registered: Jul, 2004

Re: Solve this problem if you can Posted: Jul 26, 2005 8:34 AM
Reply to this message Reply
Uh, why not just post a bullshit answer that would look good enough to trick this student into turning it in?

I mean, have some fun with him.

Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: Solve this problem if you can Posted: Jul 27, 2005 9:33 PM
Reply to this message Reply
Okay, I'll have a shot at it:

a) This "method," using the term loosly, in addition to illustrating poor coding style like the rest of the class by having a nearly meaningless name as well as meaningless variable names, also demonstrates the process used to generate a number of different compiler errors.

b) This is a trick question! Don't fall for it! It is impossible to inheritance on code that doesn't compile in the first place.

Flat View: This topic has 9 replies on 1 page
Topic: executing SQL* loader through java Previous Topic   Next Topic Topic: Killing Threads

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use