Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!

Steven Greenbaum

Ranch Hand
+ Follow
since Sep 06, 2017
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Steven Greenbaum

I would like to write a class that replaces google sheets as a calculation engine.
Presently formulas and data sre passed to google sheets via API and the result returned also via API.
I would like to do all the calculations in java code in an attempt to speed up execution.

Is there a way to avoid calculating every cell sequentially which would probable be too slow.

2 years ago
I am working with a foreign group of java programmers. I am new to java projects

Their IDE is Eclipse and they seem to be using BitBucket as a source code repository. in Bitbucket I see that there are recent commits.
These commits Im guessing are going to gitHub

What is the relationship among these tools

Thanks
3 years ago
I will try a hash map. Haver never done that before.
3 years ago
Modules have a unique id
3 years ago
Adding and deleting is most important.
These will be small groups so speed is not an issue.
Sorting not important
3 years ago
I have two classes
Module & Modules.
Modules is a group of 'module'

It is very confusing how to structure Modules after googling collections, lists, and array lists and such.

There will never be a different type of object in Modules

Should I structure Modules as an array list or some sort of collection?
3 years ago
Thank you all your excellent and detailed responses. I am glad I have found the Moose community.

I am working with a group of programmers in a foreign country. I sent them my project before adding the error checking. They have implemented it themselves and I have asked them to send it back when done because there will be may more use cases to add.
I will ruminate on the many comments you and others have provided and proceed from there.
3 years ago
Not sure if I should start a new thread.

This is my most complicated class. I can't think of anything that obvious that would cause an error.
In my test program I set the input periods to -1. This caused a NegativeArraySizeException so I could catch that.

How would I catch a general error where i don't know the exception type in advance?

Also I would like to throw an exception if periods < 3 or greater than 120.

How would I do that?
Tx


3 years ago
Aha - so it's nipped in the bud
3 years ago
In response to Stephan
Wouldn’t an integer be of the wrong type?
3 years ago

In the set method The only things I could see that could go wrong would be null input or incorrect type

Do I catch just these exceptions or something more general.

I am not sure how or whether to write a try/catch for get. What is recommended?

Thank you


3 years ago
Knute thank you very much for your help. There were a bunch  more errors in the code but with  your push in the right direction I was able to get them sorted out.

Below is my final code



and revised test code

3 years ago
added 'this' on lines 74 and 81 but stu=ill same failure
3 years ago

Knute Snortum wrote:In your OnPlanUserModule class, in the ProcessEmployees() method, line 45, you are creating a local variable headcount.  Since it's local, it cannot be accessed outside of the method.  To do that you need to either return the value (which means you couldn't return the employees reference) or you need to make headcount a field of OnPlanUserModule and write a getter for this field.



Knute-thank you for responding

Revised code per your comments but still getting same error. So Im still missing something.

3 years ago
I think I see the issue. My OnPlanUserModule class returns emplyees which I am not interested in.

I assumed that the code in lines 60-74 would output values that could be retrieved by my test program. This doesn't seem to be working.

So how do I gain access to the headcount and salary values that are being computed.
3 years ago