Hi, I need some help coming up with an algorithm that will return class 1, 2, or 3 based on the year that is entered. I have an example that works but I need something a little more simple.

`function senateclass (cycle) {
    return 3 - ((cycle % 6) % 3);
}`

for more info on the senate classes Click Here

Thank you very much for your help.

Recommended Answers

All 2 Replies

and a little more 'java', I assume?

Haha yes this is true, I mean I'm doing it in java but the language doesn't particularly matter. I was more just looking to see if other people would come up with other (more simple ideally) ways to solve the problem.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.