|
Sweet. Of course, feature creep will getcha with this one.
|
|
|
|
|
Wow, talk about obfuscating the code!
|
|
|
|
|
Psuedocode in realcode! Sweet!
Chuck Norris has the greatest Poker-Face of all time. He won the 1983 World Series of Poker, despite holding only a Joker, a Get out of Jail Free Monopoloy card, a 2 of clubs, 7 of spades and a green #4 card from the game UNO. In the movie "The Matrix", Chuck Norris is the Matrix. If you pay close attention in the green "falling code" scenes, you can make out the faint texture of his beard. Chuck Norris actually owns IBM. It was an extremely hostile takeover.
|
|
|
|
|
Reminds me of a certain guy
|
|
|
|
|
Someone who always says "please", "dear" and "best regards"? Reminds me of pretty much all of the people I work with.
|
|
|
|
|
(message found on a sharing file web site)
"Download in NaN seconds"
mmhh... maybe I try to download it tomorrow.
I'm sorry that I have not the code, but you can try to guess it.
Tommy
|
|
|
|
|
At least it doesn't produce an error or crash when trying to parse what's NaN...
|
|
|
|
|
Dealing with time produces funny horros, like the following one
(found when I was in my former company):
TotalSeconds = GetTotalSeconds();
Seconds = 0;
Minutes = 0;
Hours = 0;
for (i=0; i<TotalSeconds; i++)
{
Seconds++;
if ( Seconds == 60)
{
Seconds = 0;
Minutes++;
if (Minutes == 60)
{
Minutes = 0;
Hours++:
}
}
}
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote:
<code>long TotalMilliSeconds = gettime();
for (i=0; i<Total<code>Milli</code>Seconds; i++)
{
<code>MilliSeconds++;</code>
<code>if (MilliSeconds == 1000)</code>
<code>{</code>
<code>MilliSeconds = 0;</code>
Seconds++;
if ( Seconds == 60)
{
Seconds = 0;
Minutes++;
if (Minutes == 60)
{
Minutes = 0;
Hours++:
}
}
}
}
Ooo, I like that. Did your company receive a bug report about that "clock application" they wrote (I added the relevant code above in Red )?
SPR: #8327
PROBLEM DESCRIPTION: My clock application takes 100% CPU and doesn't update every second.
LIKELY CAUSE: long timespan = gettime(); // number of milliseconds since September 1st, 1970.
SOLUTION:
Your clock is running through 1,199,836,800,000 (1.2 trillion) iterations per second, you dumba**.
|
|
|
|
|
Sad to say (I don't like to shoot to the red cross) the authors came from VB world.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Well, that would work, but it sure is the slow way of doing it
Bill W
|
|
|
|
|
Indeed it is working. The horror application is still alive.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I understand that not everyone can be an expert at higher math, but that is really bad.
Bill W
|
|
|
|
|
It's so fast, the time is Not even a Number!
(reminds me of that _other_ guy...)
|
|
|
|
|
I. Overview
1. Create a program that will accept the necessary inputs and generate the proper outputs based on the processing instructions.
2. The program should meet all the requirements.
II. Inputs
1. Employee’s ID Number – an 8 digit integer
1st four digits signifies the year the employee started.
5th digit signifies employment type. 0 for regular, 1 for
contract. Other values are invalid.
Last 3 digits are irrelevant for this program.
2. Salary Grade – a real number
3. Days worked for the month – an integer with valid values of 1 to 31 only.
4. wBonus – a character to signify whether the employee will receive a bonus or not
III. Processing
1. Prompt for all necessary inputs. Check every input for validity.
2. Compute for the employee’s salary for the month.
Basic Salary = Salary grade * Days Worked
For employees with bonus
For regular employees who started before 1990
Bonus = Basic Salary * .4
For regular employees who started before 2000
Bonus = Basic Salary * .3
For regular employees who started before 2006
Bonus = Basic Salary * .2
For regular employees who started after 2005 and contract employees
Bonus = Basic Salary * .1
Salary for the Month = Basic Salary + Bonus
3. Accumulate Total Basic Salary and Total Bonus.
4. Display Employee’s Salary for the Month(output #1)
5. Prompt if the user wants to process another employee. If yes, go back to #1.
6. Display Total Basic Salary and Total Bonus(output #2)
IV. Outputs (use 2 decimal places for real numbers)
1. ID Number and Salary for the Month. Example:
ID Number: 19970123 Salary: P1500.50
2. Total Basic Salary and Total Bonus. Example:
Tot Basic Salary: P180,000.90 Tot Bonus: P20,000.55
V. Requirements
1. Use the printf function for all outputs including prompts.
2. Use the scanf function for accepting/reading all inputs.
3. Use defined constants for the constants used in the bonus computation.
4. Declare/define functions for each routine/subroutine in the program.
5. Use error checking. If the user inputs an invalid value, inform the user and prompt for a new value.
6. Users should be able to use the program without special instructions or training.
bleh
|
|
|
|
|
|
Do your own homework
This forum is for sharing coding horrors that you have found on the job. Usually it winds up being when one finds work done by someone else that was done in a substandard manner.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Do your own f*cking homework.
Blog link to be reinstated at a later date.
|
|
|
|
|
See here for assistance.[^]
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
If you are trying to say that these requirements are a horror, I have to disagree. Those requirements are quite resonable for a homework assignment. Also this is a "coding horror" forum not a requirements horror forum.
Bill W
|
|
|
|
|
So, I'm sure this has happened to everyone but I'm pouring through a section of v1.0 of a program I am updating. There's a section where some decent algebra is involved and all of the variables used were num1, num2, num3 etc. down the line. This is in several pages of code and it goes up to num26, but at least they are all declared locally. There is no consistency between in-line if statements and general if statements; they are used intermittently and in no semblance of order whatsoever. In two separate places, the math that is used conflicts with the documentation that was provided so now I have to figure out which is correct so I can rewrite this correctly and accurately. They had code for a dropdown box that said
if (NumOfConveyors >= 3) && (NumOfConveyors <= 4)
...so...if your dropdown box only gives me the option of whole numbers, why even check to see if there will be a number in between 3 and 4? You are never going to have .25 of a conveyor.
And there's an if instead of an elseif in a block of code which sets one of the num variables to a totally wrong number. Good times finding that one out.
"The shortest distance between two points is under construction"
-Noelie ALtito
|
|
|
|
|
So basically, if the number is 3 or 4 do something.
|
|
|
|
|
Yeah, the check to see if something is between them is pointless. Although it's not such a big deal, it is a little annoying to look at.
"The shortest distance between two points is under construction"
-Noelie ALtito
|
|
|
|
|
I don't think that's bad at all. It's written in a general way so if the bounds change, the logic doesn't have to. Maybe the bounds used to be larger, but somewhere along the way they were changed so now it looks a bit funny.
I would write it that way myself because we deal with changing parameters all the time. In fact I'd make 3 and 4 constants.
|
|
|
|
|
I totally agree. I have had requirements change far more often than not. Even for things that I was originally told that it would never change. So I always write things in such a way as to allow for easy changes in the future.
Bill W
|
|
|
|