#table java help

61 messages · Page 1 of 1 (latest)

gloomy turret
#

how to do the average of numbers i justs elected? i have done it in an other way and it worked but its not the best solutions apparently.

indigo mossBOT
#

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, 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

#

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, 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

modern cargo
#

just add them up and divide by 3?

gloomy turret
#

it works but not the right method...

modern cargo
#

?

#

Can you post the problematic code in a codeblock?

#

and what exactly goes wrong?

gloomy turret
#

everyting below that shouldnt be used

#

basically i need to do the average of the numbers elected from this

modern cargo
#

which ones?

weak summit
#

@gloomy turret moyen de l'expliquer en français pour moi pouvoir peut-être t'aider ? Car là j'y comprend rien

gloomy turret
weak summit
#

Ouais

gloomy turret
#

sans utiliser cette methode

#

a gauche la

#

avec ca

#

tu vois ce que je veux dire?

weak summit
#

Déjà pense au fait que tu peux faire des classes autres (genre une classe Personne avec toutes les infos directement dedans)
Et pour résoudre ton problème ptetre

for (int i = 0; i < matricule.length; i++) {
    double moyenne = (noteMat[i] + noteInf[i] + noteFra[i]) / 3
    // puis faire le code qui va avec, ou le stocker en arrière avec l'exemple qui suit
}
// "l'exemple qui suit" c'est:
int[] moyennes = new int[nomPrenom.length];

// a mettre dans la boucle for() à la suite
moyennes[i] = moyenne
modern cargo
#

This is an english-only server (see #rules) Please keep the discussion in english.

weak summit
#

Oh mb sry

modern cargo
#

no problem

gloomy turret
#

...

#

oh je vois je pense

weak summit
#

👍

gloomy turret
weak summit
gloomy turret
weak summit
#

Bruh

#

Can you send ur new code?

gloomy turret
weak summit
#

What you have right now

#

Only the code where the problem is if possible

gloomy turret
weak summit
gloomy turret
weak summit
#

Ouch

#

Ok im redoing the whole method here lol

#

And pleeeasse do Ctrl+Shift+F to reformat your code lol

weak summit
#
public static void produireSomme(Scanner clavier, String[] nomPrenom, float[] noteInf, float[] noteMat, float[] noteFra, int[] matricule) {
    int length = matricule.length;
    float moyInf = 0, moyMat = 0, moyFra = 0;
    float[] moyennes = new float[length];
    float moyenneTotale = 0

    for(int i = 0; i < length; i++) {
        moyInf += noteInf[i];
        moyMat += noteMat[i];
        moyFra += noteFra[i];
        moyennes[i] = (noteInf[i] + noteMat[i] + noteFra[i]) / 3;
        moyenneTotale += moyennes[i];
    }
    
    moyInf /= length;
    moyMat /= length;
    moyFra /= length;
    moyenneTotale /= length;

    System.out.println(String.format("%-9s %-25s %-5s %-5s %-5s %-7s", "Matricule", "nom, prénom", "INF", "MAT", "FRA", "Moyenne"));
    System.out.println("-".repeat(64));
    for(int i = 0; i < length; i++)
        System.out.println(String.format("%-9d%-25s%-7.2f%-7.2f%-7.2f%-7.2f", matricule[i], nomPrenom[i], noteInf[i], notMat[i], noteFra[i], moyennes[i]));
    System.out.println("-".repeat(64));
    System.out.println(String.format("%15s%24.2f%7.2f%7.2f%7.2f", "Moyenne", moyInf, moyMat, moyFra, moyenneTotale));
}
#

Lol took me 25min to write on phone 🥵 zuccSuncreen

gloomy turret
gloomy turret
#

i think it might be coz of the floats

#

yeah it was that

weak summit
#

Yea i maybe bad recopied the formatters

gloomy turret
weak summit
#

3?

gloomy turret
#

yah yeah nvm im done with it thanks

weak summit
#

Yeah 3 is just length

#

Hmm not length im idiot its 3 but ok

#

If all works dont forget to close the thread ;)

gloomy turret
weak summit
#

Just copied yourse, im not good with format

gloomy turret