#/help

5 messages · Page 1 of 1 (latest)

wise ether
#

I've created a class that represents polynomial.
In order to create the polynomial I get 2 parameters in the constructor:
(1) Parameter of arrayList<Double> that represents the coefficients
(2) Parameter of ArrayList<Integer> that represents the powers.
for example:
The polynomial = 6x^3 + 5x^2 + 3x^1
Means:
Coefficients are: 6, 5, 3
Powers are: 3, 2, 1

If the 2 arrays are different in size it will throw an Exception (Already did it)

The problem:
I need to reorganize the arrays that they will be organized by increasing-order (relative to the powers' ArrayList), so I created a private method named "sortArray" that get the 2 parameters.
The problem is, when I delete a cell from one of the arrays (only one of them, which is obviously a mistake, but I'm trying to practice everything) it detects it and throw an exception.

The question is:
Why does it throw an exception if we already passed the throw part from the constructor?
We already inside a different code in a different place, why does it still detects the throw exception from the constructor?

Hopefully I was understandable!
Thank you!

P.S:
The part I marked in yellow is the mistake because I didn't delete the current's cell from the powers' ArrayList as well.

velvet cryptBOT
#

This post has been reserved for your question.

Hey @wise ether! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

wise ether
#

/help
I still get the same problem even when I delete from both arrays

viral heartBOT
#

Update: Discord changed their client to prevent sending messages
that are preceeded by a slash (/)
To run code you can use "./run" or " /run" until further notice

Here are my supported languages:
awk, bash, basic, basic.net, befunge93, bqn, brachylog, brainfuck, c, c++, cjam, clojure, cobol, coffeescript, cow, crystal, csharp, csharp.net, d, dart, dash, dragon, elixir, emacs, emojicode, erlang, file, forte, forth, fortran, freebasic, fsharp.net, fsi, go, golfscript, groovy, haskell, husk, iverilog, japt, java, javascript, jelly, julia, kotlin, lisp, llvm_ir, lolcode, lua, matl, nasm, nasm64, nim, ocaml, octave, osabie, paradoc, pascal, perl, php, ponylang, powershell, prolog, pure, pyth, python, python2, racket, raku, retina, rockstar, rscript, ruby, rust, samarium, scala, smalltalk, sqlite3, swift, typescript, vlang, vyxal, yeethon, zig

You can run code like this:
./run <language>
command line parameters (optional) - 1 per line
```
your code
```
standard input (optional)

Provided by the Engineer Man Discord Server - visit:
https://emkc.org/run to get it in your own server
https://discord.gg/engineerman for more info