0

Sort by - Sorting

Html = <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title> Programmieren in Typescript</title> </head> <body> <header> Aufgabenblatt 6</header> <script language="javascript" type="text/javascript" src="uebung%206.js"></script> <script language="typescript" type="text/typescript" src="uebung%206.ts"></script> </body> </html JavaScript= public class Program { public static void main(String[] args) { int minimum = 0; int maximum = 300; System.out.println ( "It was launched at " + (minimum) + "and evaluated up to " + (max) + . "); System.out.println (""); int sort2[] = new int [maximum + 1]; int sort3[] = new int [maximum + 1]; int sort5[] = new int [maximum + 1]; int unsort[] = new int [maximum + 1]; int number sequene = minimum; int help = minimum; while (help <= (maximum)){ if ((number sequence % 3) == 0){ sort3[help] = number sequence; } else { unsort[help] = number sequence; } help += 1; number sequence += 1; } help = minimum; System.out.println ("Sorting 3:"); while (help <= (maximum)){ if (sort3[help] > 0){ System.out.print (sort3[help] + ", ");} help += 1;} System.out.println ("_______________________________________"); System.out.println (""); help = 0; System.out.println ("Sorting unsorting:"); while (help <= (maximum)){ if (unsort[help] > 0){ System.out.print (unsort[help] + ", ");} help += 1;} System.out.println ("_______________________________________"); System.out.println (""); help = 0; } } import java.util.arrays; class programm { public static void main(string[] args) { int[] a={3,2,1,7} arrays.sort(a); system.out.pintIn(arrays.toString(a)); } Why is this don't Working?

1st Jun 2019, 2:33 PM
A.S
15 odpowiedzi
+ 2
You used java instead of javascript. That doesn't really work
1st Jun 2019, 2:50 PM
Airree
Airree - avatar
+ 2
That is java..
1st Jun 2019, 2:53 PM
Airree
Airree - avatar
+ 2
Javascript doesn't need to put all of code to be executed in a method, or a class You don't need to declare variables with a type, just use "let" or "var" To print text, use "document.write" or "console.log" instead of "System.out.println" The array methods are already in javascript, so you don't need to import it, and they need to be declared inside square brackets like this: let arr = [1, 2, 3, 4];
1st Jun 2019, 3:00 PM
Airree
Airree - avatar
+ 2
Yes, I know. Maybe if you would share the code, preferably using a link
1st Jun 2019, 3:14 PM
Airree
Airree - avatar
+ 2
Your code is seriously inconsistent, unreadable and confusing 1. You didn't do anything with the code that I told you, just changed like 4 functions. You still don't need classes, or importing anything, or declaring the types whem declaring variables 2. You cannot use whitespaces in variable names, so "number sequence" isn't a valid variable name 3. The code blocks aren't opened and closed correctly 4. You should declare arrays like this: let arr = new Array(length); 5. You should use spacing that is readable 6. You don't need to use parentheses everywhere 7. You don't need to use another printing function for line breaks, you can use "\n" Example: console.log("Line\nBreak"); /*Outputs: Line Break */
1st Jun 2019, 4:30 PM
Airree
Airree - avatar
+ 1
You should close all tags in HTML, so at the end close </html>, and you don't need to set the language of it
1st Jun 2019, 3:08 PM
Airree
Airree - avatar
+ 1
What is not working?
1st Jun 2019, 3:11 PM
Airree
Airree - avatar
+ 1
Make a code on sololearn, then share it
1st Jun 2019, 4:01 PM
Airree
Airree - avatar
0
i used javascript..
1st Jun 2019, 2:52 PM
A.S
0
where is the difference, what should i do know, i dont get this ..
1st Jun 2019, 2:54 PM
A.S
0
what should i change in html?
1st Jun 2019, 3:03 PM
A.S
0
it is still dont working ..
1st Jun 2019, 3:09 PM
A.S
0
this code sorting
1st Jun 2019, 3:13 PM
A.S
0
and how
1st Jun 2019, 4:00 PM
A.S
0
ok i've done it can you check ?
1st Jun 2019, 4:07 PM
A.S