On Github renemeye / GoodCode
oder auch ... blamiert euch nicht unnötig
int num[] = new int[5]; System.out.println("Ein:"); Scanner sc = new Scanner(System.in); for(int p = 0; p<5; p++) num[p] = sc.nextInt(); int j; boolean flag = true; // set flag to true int temp; // holding variable while (flag) { flag = false; // set flag to false awaiting a possible swap for (j = 0; j < num.length - 1; j++) { if (num[j] < num[j + 1]) // change to > for ascending sort { temp = num[j]; // swap elements num[j] = num[j + 1]; num[j + 1] = temp; flag = true; // shows a swap occurred } } } int z=0; for(int t = 0; t<5; t++) z += num[t]; System.out.println("Erg:"+z/5.0);
private static final int ARRAY_LENGTH = 5; public static void main(String[] args) { int arrayOfIntegerValues[] = new int[ARRAY_LENGTH]; askUserForInput(arrayOfIntegerValues); sortWithBubbleSort(arrayOfIntegerValues); double meanValue = calculateMeanValue(arrayOfIntegerValues); printResultToConsole(meanValue); } private static void printResultToConsole(double result) { System.out.println("The mean Value is:"+result); } private static double calculateMeanValue(int[] allValues) { int sum = calculateSumOfValues(allValues); return sum/(double)allValues.length; } private static int calculateSumOfValues(int[] valuesToSum) { int sum=0; for(int arrayCounter = 0; arrayCounter<valuesToSum.length; arrayCounter++) sum += valuesToSum[arrayCounter]; return sum; } private static void sortWithBubbleSort(int[] arrayToSortOn) { int positionnOnArray; boolean hasSwaped = false; int temporary; while (!hasSwaped) { hasSwaped = true; for (positionnOnArray = 0; positionnOnArray < arrayToSortOn.length - 1; positionnOnArray++) { if (arrayToSortOn[positionnOnArray] < arrayToSortOn[positionnOnArray + 1]) { temporary = arrayToSortOn[positionnOnArray]; arrayToSortOn[positionnOnArray] = arrayToSortOn[positionnOnArray + 1]; arrayToSortOn[positionnOnArray + 1] = temporary; hasSwaped = false; // shows a swap occurred } } } } private static void askUserForInput(int[] valueStorage) { System.out.println("Pleas enter some Values:"); Scanner consoleReader = new Scanner(System.in); for(int inputNr = 0; inputNr<valueStorage.length; inputNr++) valueStorage[inputNr] = consoleReader.nextInt(); }
int ínt = 5;
int sobitteauchnichtdaskanndochkeinerlesen = 5;
int _ = 5; int __ = 8; int _$__ = _ - ___;
(Fürs Protokoll: Das sind NEGATIV Beispiele!)
String einBeispiel = "Test"; int verschiedeneWorteGetrenntDurchEinGroßesZeichenAmAnfang; StringWithExtensions test = "Foo Bar";
final int FIXED_ARRAY_LENGHT = 42; final String RANDOM_HASH = "Deine Mudda!";
package de.ovgu.iti.softwareengineering; package de.ovgu.iti.software_engineering;
Apps Hungarian
mpchgr
(Array, dessen Elemente Klassen sind und von positiven Bytes indiziert wird.)
Systems Hungarian
String m_szLastName;
(Eine Member-Variable eines null-terminierten Strings.)
A wise man:
"Hungarian Notation is the tactical nuclear weapon of source code obfuscation techniques; use it!"a_crszkvc30LastNameCol `
foo[p] = sc.nextInt(); // versus valuesFromUser[inputIndex] = consoleReader.nextInt();
if(a == b){ if(x==z){ do something(); } if(c == 0){ while (flag) { flag = false; for (j = 0; j < num.length - 1; j++) { if (num[j] < num[j + 1]){ doAnything(); } } } if(b == x){ while (flag) { flag = false; for (j = 0; j < num.length - 1; j++) { if (num[j] < num[j + 1]) { doAnything(); } } } } while (en.hasMoreElements()) { type type = (type) en.nextElement(); for (int i = 0; i < args.length; i++) { if(a == b){ if(x==z){ do something(); } if(c == 0){ while (flag) { flag = false; for (j = 0; j < num.length - 1; j++) { if (num[j] < num[j + 1]) { doAnything(); } } } if(b == x){ while (flag) { flag = false; for (j = 0; j < num.length - 1; j++) { if (num[j] < num[j + 1]) { doAnything(); } } } } } } } } } }
int num[] = new int[5]; System.out.println("Ein:"); Scanner sc = new Scanner(System.in); for(int p = 0; p<5; p++) num[p] = sc.nextInt(); int j; boolean flag = true; // set flag to true int temp; // holding variable while (flag) { flag = false; // set flag to false awaiting a possible swap for (j = 0; j < num.length - 1; j++) { if (num[j] < num[j + 1]) // change to > for ascending sort { temp = num[j]; // swap elements num[j] = num[j + 1]; num[j + 1] = temp; flag = true; // shows a swap occurred } } } int z=0; for(int t = 0; t<5; t++) z += num[t]; System.out.println("Erg:"+z/5.0);versus
public static void main(String[] args) { int arrayOfIntegerValues[] = new int[ARRAY_LENGTH]; askUserForInput(arrayOfIntegerValues); sortWithBubbleSort(arrayOfIntegerValues); double meanValue = calculateMeanValue(arrayOfIntegerValues); printResultToConsole(meanValue); }
/** * @param front will be the first part * @param middlepart will be the second part * @param end will be the last part * @return A concatenated String for the three params */ public static String concatenate(String front,String middlepart,String end){ ... } /** * @version 4.2 März 2013 * @author René Meye. * This class proviedes some additional mathematical functions. */ public class Mathematics { ... }
können schädlich sein
Verrutschter Kommentar
//STEP 1: Sort all Elements test[0] = null; Array.sort(test);
int config = 2231832; //RIPJWvG
viele Weitere: Stackoverflow - best comment in source code
Imagine there = (would) be.someOtherCode.here();
#define fucking unsigned ... return *this << (fucking long) value;
int fueftesElement = 5[ptr];
You can select from different transitions, like: Cube - Page - Concave - Zoom - Linear - Fade - None - Default
Reveal.js comes with a few themes built in: Sky - Beige - Simple - Serif - Night - Default
* Theme demos are loaded after the presentation which leads to flicker. In production you should load your theme in the <head> using a <link>.