Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Counter.java

Name: Anonymous 2014-09-04 11:02

why the fuck do retards have to invent a goddamned class just to use a goddamned integer? have people no shame?

Counter.java

/**
* A simple counter class that can be initialized to
* a specific value, incremented, and cleared.
* @author Owen Astrachan
*/

public class Counter
{
int myCount;

/**
* Construct a counter whose value is zero.
*/
public Counter()
{
myCount = 0;
}

/**
* Construct a counter with given initial value.
* @param init is the initial value of the counter
*/

public Counter(int init)
{
myCount = init;
}

/**
* Returns the value of the counter.
* @return the value of the counter
*/
public int getValue()
{
return myCount;
}

/**
* Zeros the counter so getValue() == 0.
*/
public void clear()
{
myCount = 0;
}

/**
* Increase the value of the counter by one.
*/
public void increment()
{
myCount++;
}

/**
* Return a string representing the value of this counter.
* @return a string representation of the value
*/

public String toString()
{
return ""+myCount;
}
}

Name: Anonymous 2014-09-06 12:01

>>10
>>41
protip: computer science is not a course in programming. If you want a course in programming, you do a programming course. Computer science is about the theory of information and computation.

Name: Anonymous 2014-09-06 13:01

It doesn't even check for an overflow condition. Also, for a voting machine it should have some sort of access control on the count reset.

Name: Anonymous 2014-09-06 13:12

>>41-nigger was exploded before he could optimise his quotes

Name: Anonymous 2014-09-06 18:13

>>40
Shalom!

Name: Anonymous 2014-09-07 0:23

>>42
Zeroed your counter, nida!

Name: Anonymous 2014-09-07 2:09

def makeInc(x):
def inc(y):
# x is "closed" in the definition of inc
return y + x
return inc


/THREAD

Name: Anonymous 2014-09-07 4:49

>>46
top kek, you are even dumber than astra-chan.

Name: Cudder !MhMRSATORI 2014-09-07 13:42

>>29,31
votes[candidate]++;

OOP and the rest of that ENTERPRISE BULLSHITE is in some way really clever; it makes it far easier for many people to get paid doing what looks like really productive work. It's a great method of expanding work to keep people employed at all costs. A single person with a few days would probably be enough to write the whole software for a voting machine, at very little cost, but when the job is given to some huge company it ends up turning into a bloated monstrosity "requiring" tens or even hundreds of people over months or years and going overbudget, and the product still contains bugs!

You don't even need a database to count votes; assuming there are less than 257 candidates in any single vote, the largest country in the world still requires less than 2GB if every single person in it (and that's including people who can't vote) got a byte to put their choice in.

The costs of running a database - which probably means licensing fees, server costs (disk, OS, power, etc.), and a team of overpaid DBAs and "developers", can be replaced by a single memory device costing less than $10.

Of course they'll probably complain and give all sorts of reasons why a database is "needed", but that's just because they're desperate to keep their jobs... no, I think a DB is absolutely NOT needed for this application. Vote data is vote data. It's created to be counted. It doesn't need anywhere near the processing flexibility that a database gives.

Name: Anonymous 2014-09-07 14:07

>>48
I love you, Cudder-dono.

Name: Anonymous 2014-09-07 14:28

>>49
* donna Cudder

Name: Anonymous 2014-09-07 15:42

>>48
To help protect against voter fraud, there should be some redundancy in the data collected. For worst anonymity, the voter's id is attached to their vote with timestamp and the table is made public. Each voter can confirm their vote. Everyone can perform a recount and that published voters are alive. If someone suspects a voter didn't actually go to the polls, they can contact them and use an alibi to prove voter fraud occurred.

Name: Anonymous 2014-09-07 18:14

>>50
The -dono honorific is gender-neutral.

Name: Anonymous 2014-09-07 18:38

>>48
Shalom!

Name: Anonymous 2014-09-07 21:17

Name: Anonymous 2014-09-07 21:44

>>54
Computer Science with C++
bad reviews
not surprising

Name: L. A. Calculus !jYCj6s4P.g 2014-09-07 22:30

>>1
WAT KINDA PLASTIC FISHER'S PRICE RETOID WUD WRITE DAT SHIT? YAINT RED DA FUCKIN STANDARD
#include <stdio.h>

#define MAXDIGITS 3

struct count {
char base[MAXDIGITS + 1];
char *s, *endp;
};

void clear(struct count *countp)
{
countp->s = countp->base + MAXDIGITS - 1;
*countp->s = '0';
countp->endp = countp->base + MAXDIGITS;
*countp->endp = '\0';
}

int increment(struct count *countp)
{
char *p;

for (p = countp->endp; p > countp->s; *p = '0')
if (*--p != '9') {
++*p;
return 0;
}
if (countp->s == countp->base)
return 1;
*--countp->s = '1';
return 0;
}

int main(void)
{
struct count count;

clear(&count);
while (increment(&count) == 0)
puts(count.s);
return 0;
}

Name: Anonymous 2014-09-08 9:13

BeanCounter.java

Name: Anonymous 2014-09-08 14:57

Who are you quoting, >>55-kun?

Name: /jewtube/ 2014-09-08 15:58

>>58
Some Canadian Amazon reviewer obviously.

Name: Anonymous 2016-11-10 17:55

>>55
even my intructor said this book is not book

Name: Anonymous 2016-11-10 23:33

Name: Anonymous 2016-11-10 23:35

(define (make-counter)
(let ((value 0))
(lambda ()
(set! value (+ value 1))
value)))

Name: Cudder !cXCudderUE 2016-11-11 2:59

http://www.cs.duke.edu/csed/poop/huff/

Found more bullshit (I am not sure if the URL is meant to be satirical) from the same guy.

Huffman Coding, sounds like a good thing to have students play with. That I agree with. What's wrong? Everything else. Explicitly storing Huffman trees, actually using a tree for the algorithm, turning dozen-liners into multiclass ENTERPRISE monstrosities, and ignoring the simplicity and elegance of Canonical Huffman are things that no one actually does in the real world.

Name: Anonymous 2016-11-11 4:13

>>63
poop

Name: Anonymous 2016-11-11 6:01

Check em

Name: Anonymous 2016-11-11 6:07

>>65
You want me to check those? You better get ready to check my dubs.

Name: Anonymous 2016-11-11 15:24

>>63
/poop/huff
that was jenkem quality!

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List