BestJewSinceJC 700 Posting Maven

You can get rid of this: print grade
and change your module to this:

gradePercent(grade){
if gradePercent < 60 then
print “Fail”
else
print”Pass”
}

If you do those two things, you will have fulfilled your requirements. So what's the problem?

BestJewSinceJC 700 Posting Maven

If you split the project into who writes what function, the variables is a trivial matter. But again, the project is so small anyway, I don't see how you could split it into more than three parts -- getting the user's input and calculating the answer and printing the output. And even that is really a stretch. And another note - on a real project, you use a code management system such as CVS or SVN where everyone can share code, but without working on the same code at once or interfering with each other.

BestJewSinceJC 700 Posting Maven

The point is, the existeValor method takes three arguments, but you were only passing in one argument. That will only result in a compiler error - the two are treated as completely different methods. So yes - you are on the right track.

BestJewSinceJC 700 Posting Maven

Seriously - if you can't figure out how to use code tags then read the stickies at the top of the forum that explain in detail how to do so. Or you could just quote one of the other members in here (such as Jocamps) who used code tags in their post, and it would show you exactly how to do it.

BestJewSinceJC 700 Posting Maven

I love food.

BestJewSinceJC 700 Posting Maven

I'm not scouring the whole thread to point out what you missed - all you have to do is go back and read it again. But I don't understand why you think the fact that an opinion exists makes it the truth. (For example, you keep quoting articles/linking to articles, as if the fact that those articles exist somehow makes the opinions they express true rather than just another opinion).

BestJewSinceJC 700 Posting Maven

[In general you would go through one of many software development processes, depending on what company or organization you work for.] For your project, however, you could have simply had a meeting with your team and determined the essential aspects of your project. Then, once you had the essential "functions" into place, you could each go work on one, which would lead to finishing more quickly than if everyone on your team is doing the same project separately. For example, you could be working on the part of your program that prompts the user to input a height and reads in that height. Your friend could be working on calculating the final answer given the height.

BestJewSinceJC 700 Posting Maven

Yeah, I think I can do that in about ten minutes for you. But first, how much are you going to donate to Daniweb for wasting everyone's time?

BestJewSinceJC 700 Posting Maven

I'm not trying to be rude, but Narue already had a pretty good explanation of at least one of your questions in a similar thread that was created in this forum recently (it should still be on the first page).

(The question):
"I think big-o describes the upper bounds of an algorithm's cost or something? With that, how do you describe and analyze an algorithm?"

As for amortized cost, amortized analysis deals with considering the worst case running time of a sequence of M operations. If you want an example of why this is useful look into splay trees big-oh cost versus their amortized cost.

BestJewSinceJC 700 Posting Maven

Forgive me if I have misunderstood here, but it looks to me like you are trying to get an actual Object to put into the array - hence clone and new.
Arrays don't hold Objects. Just like variables, they hold references (pointers) to Objects. So if you have found a nearby Item, and stored (a reference to) it in variable nearebyItem, yo can simply say
player.inventory[0] = nearbyItem;
That copies the reference into the aray, so player.inventory[0] now refers to the same Item as nearbyItem does.

True, but he could also use player.inventory[0] = new Item(); (assuming the constructor exists), and he said he tried that and it "didn't work", whatever that means.

BestJewSinceJC 700 Posting Maven

"i think the most grievous offender is the row of "share this" "send that" "bookmark" "yadda yadda" buttons... I think they're ugly and extremely distracting/annoying. i would get rid of all that, because i never use any of that stuff. i think it would go a long way to cleaning up the clutter."

I disagree, I never even notice those things.

@ Dani - I like the overall layout of the site. It has one of the cleaner, nicer looking interfaces I've seen on a forum without being overly complex.

BestJewSinceJC 700 Posting Maven

I personally like the system. I also think it was well designed as far as the interface. The only thing I don't like is that it is going to discourage people from disagreeing (see: this thread) because they will be down voted just for having a different opinion, (which in my opinion is a mis-use of the system, but that can't be controlled).

BestJewSinceJC 700 Posting Maven

private double Height;

It looks like height should be lowercase there, according to the rest of your class. Btw, making variables lowercase to start with is a convention in Java.

BestJewSinceJC 700 Posting Maven

The new Item approach you listed will definitely put an item into inventory, assuming that inventory is an array of Items. However, whether or not the item will be what you want it to be depends on what parameters you are passing in. Could you post the Item class and the class where you declare the array, in code tags?

BestJewSinceJC 700 Posting Maven

Routers can use queues. I'd elaborate but if you want to use it as an example, it'll force you to research it first to figure out the correct terminology/phrasing for an example.

BestJewSinceJC 700 Posting Maven

sum=0;
for(i=0;i<n;i++)
for(j=0;j<i;j++)
sum++;
what is the actual running time of this code??

Not positive, but it's probably theta (n * n!) = theta (n^2).
The reason I'd say that is because the outer loop is O(n) and the inner loop is always one less than whatever the value is of the outer loop, so it is something like n (n-1) (n-2) ... 1 = n!

Rashakil Fol commented: nice! +6
BestJewSinceJC 700 Posting Maven

Hold on a second - when did I mention online data backup?

Um, tried Microsoft works back in the bad old days (Windows 3.1) and never touched it since, it was so bad. Wordstar 3.3 was better. So was Easy Writer (called Sleazy Writer by fans). Word Perfect for Windows wasn't bad. Word itself wasn't bad (though over the years it's gotten pretty bloated).

Me, I like being able to work unplugged, so the extra time (Apple claims 7, I get 6+) is useful.

Music/Video editing software - use them all the time. But I'm retiring the music editing software, we are buying a Korg Oasys which includes everything you need to produce your own Audio Compact Discs.

As to the speed difference, you may not have taken into account the FSB speed (most people don't) or the actual screen specifications (Apple screens are generally of higher quality).

And it has an operating system that the New South Wales police don't warn you against (see previous post).

I highly doubt that Dell would put together a machine that was unbalanced by putting in a bottleneck in the FSB, if that is what you are suggesting (which it seems it is). In any case, the FSB speed for both systems is 1066 MHz. . . Not that it matters (if you look into it more, I believe the speed does not determine the actual bandwidth, although I'm no expert). The point is that including video editing, music editing, and …

BestJewSinceJC 700 Posting Maven

Maybe I am overlooking the obvious, but why can't you use the depth property to help you test for an AVL tree?

BestJewSinceJC 700 Posting Maven

JoCamps is correct, as a hint for how to display the array backwards, consider writing a for loop that starts at the ending index of the array and goes backwards, printing out the element at each index.

BestJewSinceJC 700 Posting Maven

Your project description literally tells you exactly what you need to do. Create an array of ten integers. Every time you see a 0, increment array[0]. Every time you see a 1, increment array[1]. Etc.

BestJewSinceJC 700 Posting Maven

They just gave you a more than sufficient reply. If you don't understand the reply either go study about for loops and arrays, or ask a specific question if there is something you don't understand. We can't read your mind.

BestJewSinceJC 700 Posting Maven

OK, so the machine may not be quite the same, but is probably close (horseshoes, hand grenades, and tactical nuclear weapons). But I have a few questions:

1) Did you buy anti-virus software?
2) Did you buy firewall software?
3) Did you buy CD/DVD burning software?
4) Did you buy photo management software?
5) Did you buy Video editing software?
6) Did you buy backup software?
7) Did you buy music editing/recording software?
8) Did you buy an office suite?
9) Do you get 6 plus hours of battery life?

For questions 1 to 7, it's either included with the Mac, or you don't need it (anti-virus). For question 8, Apple's IWord costs $79.00, and it's really nice (Pages, Numbers, & Keynote) while Mail comes with the Operating system (or of course you could download Open Office for free - I have both IWork and Open Office installed, and use both). For my business I use IWork a lot, because it comes with a lot of templates which save me time. I use Open Office for handling incoming documents because it has superior import capabilities (and then it's copy and paste into IWork).

So did you save $200,00? Or did you buy a machine that was priced $200,00 less.

Me, I'm glad I bought my Mac. Quite frankly it's the best computer I've ever had (my previous favorite was my Commodore 64).

Apple may be a pain in the ass in a …

BestJewSinceJC 700 Posting Maven

It doesn't work because you put it inside of a for loop. Meaning that every time the for loop is executed, it gets appended however many times the loop iterates. Since you only want it appended once, you would need to put the append statement before the for loop. You would also need to take out the extra stuff, and make it only say

jtaTable.append("Interest Rate" + "\t" + "Monthly Payment" + "\t\t" + "Total Payment" + "\n");

So essentially, that will give you a header that has three columns: Interest Rate, Monthly Payment, and Total Payment.


Oh, and one more thing: You also need to clear the text area when the button is clicked. So use jtaTable.setText(""); at the beginning of your logic inside the actionPerformed method. Otherwise, every time you calculate a different loan amount, it will still have the previous calculation shown in the JTextArea.

After the changes I've suggested, your code would look something like this:

if (e.getSource() == showTable)
		{
			//Clear the text area of previous calculations
                         jtaTable.setText("");
			
			double monthlyInterestRate;

		    double monthlyPayment;

		    double totalPayment;

		 
		      jtaTable.append("Interest Rate" + "\t" + "Monthly Payment" + "\t" + "Total Payment" + "\n");

		    for (double annualInterestRate = 5.0; annualInterestRate <= 8.0;

		      annualInterestRate += 1.0 / 8) 

		   {

		      // Obtain monthly interest rate

		      monthlyInterestRate = annualInterestRate / 1200;

		 

		      // Compute mortgage

		      monthlyPayment = amount * monthlyInterestRate /

		        (1 - (Math.pow(1 / (1 + monthlyInterestRate), years * 12)));

		      totalPayment = monthlyPayment * years * 12; …
BestJewSinceJC 700 Posting Maven

you should NEVER rely on hashCode to be even remotely unique.

As to Enums, read up on those. You can switch on them as well as on integer constants.

Actually, I changed my mind. I disagree. You can rely on the hash to be unique if you know that the hash keys are fixed in advance, which in this case, you do know, because the keys are colors, and you know the set of colors that you're using in advance. In other words, you can easily test to make sure that the hash is unique. That aside, I agree with you, because it still doesn't make sense to use a hash table - what would you map to what? He's trying to decide what color a string represents. . so you're mapping colors to colors, just to use the index in a switch statement? That is unnecessary overhead and a waste of time. Similarly, the idea that someone brought up about using the enum mapping is a waste of time.

BestJewSinceJC 700 Posting Maven

And what is your question? You said you can't figure out how to display the header only once. What do you mean by that? Because you said 'header' on the one hand, on the other hand, the only area where you are really displaying stuff is the JTextArea, but that is not a header. . please clarify your question & why you think it isn't working, what you want it to do, etc.

BestJewSinceJC 700 Posting Maven

I agree with you, addict. I found an interesting note on wikipedia as well: "Another notable difference is that static member classes cannot implement an interface, unless that interface is simply a marker. So if the class has to realize a contract expressed by an interface, it really has to be a singleton."

BestJewSinceJC 700 Posting Maven

Wow. . seriously? Go to the php forum. Start a new thread. This thread was started in 2005.

BestJewSinceJC 700 Posting Maven

The switch statement just compares each case to whatever you are switching on, be it an int or a char. So I think there would be no tables, the assembly instructions would basically just subtract the case (ex 'q') from what you're comparing to it, (ex 'a') and then set a flag which it'd use to see if q was >, <, or = a.

BestJewSinceJC 700 Posting Maven

I typed 72 wpm three times in a row, but made 3 mistakes each time. I also type with two fingers. And who said home row meant anything !?!!?!

edit: got up to 81 wpm with 3 mistakes

BestJewSinceJC 700 Posting Maven

Actually if you compare a Mac against a Dell, same specs, the prices are pretty close.

Not really. After a little research, I found a few articles that agree with your point, but the prices are no longer valid and the points do not apply to average computer users (for example, the average computer user does not need most of the software that comes standard on a mac). I recently (under two months ago) bought a Dell, and I was considering a Mac (not seriously, but I did compare prices). The prices were hundreds of dollars better for Dell. Of course, I was only really including processor speed, RAM, and cache size in my analysis. . I wasn't too worried about the video card, what software comes standard, etc. . so those probably play a factor. But for the average computer user (and I probably require a higher end computer than the average user) a Dell is much more affordable. The most inexpensive Mac that I considered usable for me was over a grand. After building a Dell that had more than enough power and memory, it was around 800.

BestJewSinceJC 700 Posting Maven

I don't see any other errors. . can you re-post your updated code? It seems like it still thinks your case is wrong somewhere.

BestJewSinceJC 700 Posting Maven

You click the code button. Doing so produces the two tags that are enclosed in [][]. Before the first ']', put =Java. So it will say . Put your code inbetween so [code=Java]YOUR CODE HERE[othertag][code=Java]. Put your code inbetween so YOUR CODE HERE[othertag][code=Java]YOUR CODE HERE[othertag]

BestJewSinceJC 700 Posting Maven

You can find all kinds of information on these on google. Top down is typically thought of as breaking your problem into subproblems, then breaking these subproblems into further subproblems until you have methods/functions that do one thing well. Bottom up is a bit harder to explain, here is a link that I think does an ok job, but you're better off researching it yourself. http://nothing.tmtm.com/2002/06/bottom-up-programming/

di2daer commented: nice article +2
BestJewSinceJC 700 Posting Maven

You would need a static class variable called 'numberOfBooks' declared as an int and you would simply do numberOfBooks++; every time you added a book to your collection (or whatever causes you to want to increment that category).

BestJewSinceJC 700 Posting Maven

if ((col >= 19 && row < 16 & col >= 21 && row < 18 && col >= 25 && row < 22 && col < 27 && row < 12 && col < 29 && row >= 8) {

row < 16 & col >= 21 will not do what you think it will. You probably want to change the '&' to '&&'. Also, your post would typically be posted in the C forum, not in the computer science forum as far as I know. And what is the point of saying things such as "if col >= 19" and then immediately saying "if col >= 21"? If col is >= 21, then clearly, it is also > 19.

BestJewSinceJC 700 Posting Maven

a website would store prices on their own database so that people can't mess with the price.

Professional sites will do that. For example, you aren't going to catch websites for companies like best buy or online businesses such as Amazon that don't check the price against their database when you buy an item. But if you are using a program such as Firebug, I think you can capture and edit web pages - so basically, if you were on a website and were purchasing an item, you could edit the price of the item and then buy it, assuming they did not check to see if the price matched on the server side. I know that is a little off topic from what you were saying, but it is a concern. And illegal to do, obviously.

http://getfirebug.com/

I don't personally use firebug but there's the link to the tool I was talking about.

Oh, and as for your original question, it could be the website doing it I suppose - if they had some way to detect the specs or type of your machine. I guess it would be clever to attempt to charge people using higher end machines a higher price for the same item. Dishonest but still. That might not even be possible, I'm just speculating. There could even be a virus, although that would seem very strange and implausible as well. Have you tried looking at the same website on multiple …

iamthwee commented: props to you for mention firebug. +11
BestJewSinceJC 700 Posting Maven

Oh, sorry man. Didn't mean to step on your toes, I don't know why I didn't read that part of your response or didn't register it or something.

Edit: Also, I don't know why somebody would down vote my post. I am a regular poster here and I never 'repeat responses' or anything like that - I don't even respond if I have nothing to contribute - this was obviously an accident.

BestJewSinceJC 700 Posting Maven

Private and Public should be changed to private and public. They are supposed to be lowercase - I think it will give you a compiler error otherwise.

BestJewSinceJC 700 Posting Maven

where's ProductDB.inventory declared? you can't just start referencing variables in a function when they were declared in main. You might want to pass it as an argument or declare it somewhere else. :D

ProductDB is a completely different class than ProductApp, and inventory is a variable in ProductDB that is not declared as static. But he is treating the 'inventory' variable as if it was static, which is why the compiler is complaining. The solution is to either declare inventory as a static variable, or to create a ProductDB object (which he already did, in main, as you said), pass it into the method, and use it to access the inventory variable.

BestJewSinceJC 700 Posting Maven

http://java.sun.com/docs/books/tutorial/essential/io/rafs.html

RandomAccessFile will allow you to read from the file but it will also allow you to access it at any point in the file, which it seems you already know. I don't see anywhere where you are *only* trying to read from the file (and if you were trying to read the whole file why use RAF?). Basically - What problem are you having?

BestJewSinceJC 700 Posting Maven

I don't really remember. You don't have to specify it through the interface builder tool though, you can simply edit the code itself. On the left you should have some sort of list that indicates what component you are currently highlighting - all you'd need to do is figure out what the name of your JPanel is, by looking through the variable declarations netbeans has done for you (in the code) and then use panel.setColumns and panel.setRows. I have a new computer now, and haven't downloaded netbeans, otherwise I'd tell you how to do it with the interface builder itself.

BestJewSinceJC 700 Posting Maven

Yeah, perhaps if you keep posting that question everywhere, we'll be more likely to help you with it.

BestJewSinceJC 700 Posting Maven

angle in degrees = angle in radians * 180 / Pi

Use that formula to fix the output. Or to fix the calculations in your code, wherever your miscalculations may be if you have any.

BestJewSinceJC 700 Posting Maven

Hmph. Well I looked it up and what I said wasn't really true - by convention, you'd do what I said above, but it isn't required by the language. Either way, if you have this folder structure:

cmscassignment->(class1.java, class2.java)
and class1.java and class2.java both say package cmscassignment; at the top, it should work. If that isn't working for you I'd suggest using an IDE to create your file structure for you, then just drag and drop those files/folders wherever you want to.

BestJewSinceJC 700 Posting Maven

As to your IT professionals - they are wrong. Which makes them not very professional in my book.

Let me explain the difference in simple terms. .

First of all, calling people "unprofessional" when they are not here to defend their opinion speaks volumes about you, none of it good. Second of all, I have spoken to these people in real life, and I know they are successful and I know they are SMEs, so why would I dismiss their opinion based on something "Mad Hatter" said online? Third, I know what modularity is. Don't patronize me.

:)

majestic0110 commented: Amen, brother :) +0
scru commented: Didn't I tell you guys to just ignore it? +0
BestJewSinceJC 700 Posting Maven

You just want to count how many times a value is in the linked list? If so, I don't see how your method could work.

if (x.value != value){
return 0;
}

The first time the value isn't at the node, it will stop, even if the value is found at some later node in the list. Right?

BestJewSinceJC 700 Posting Maven

To do that you will essentially need a ton of logic. For example, 717 would print out seven hundred seventeen whereas 707 would print out seven hundred and seven. You would have a bunch of cases like this. You could begin by examining the similarities instead of the differences: For example, for any value, the first part will always be the same (i.e. both 523 and 512 start with 'five hundred').

But even in more complicated cases, such as
540,546
1,234,332

You'll notice it is still pronounced with the same rules. You should start by creating some arrays where depending on how many digits into the number you are, you can access the array and it will give the appropriate word (i.e. thousand, million, billion, etc).

BestJewSinceJC 700 Posting Maven

Oh. I should have noticed that to begin with - when you declare a package, on the file system, it has to be in that folder. So your two classes that were declared as the package CPSC331Assignment2 would have to be in a folder called CPSC331Assignment2. It has nothing to do with Linux.

BestJewSinceJC 700 Posting Maven

Oh, another thing - you printed the diameter twice, but your project description asks for you to print it once.

OrangeNaa commented: Thank you very much for the help!! Not only did you really help me out, but you came back and made sure you gave me the correct evaluation! It's very appreciated=) Take care!! +0
BestJewSinceJC 700 Posting Maven

But how does that help him learn anything. . ?