• Have something to say? Register Now! and be posting in minutes!

Coding

Brees#1

Well-Known Member
7,462
330
83
Joined
Jul 31, 2013
Hoopla Cash
$ 1,000.00
Fav. Team #1
Fav. Team #2
Fav. Team #3
Just started programming and fundamentals and already am overwhelmed.

For starters, I'm in pre-calc which covers some of this stuff in CS which I have yet to learn in pre-calc.

So I have never done minutes and seconds before in a drt situation. And then add kilos.

Anyway, here's what I did for my population
For minutes, I divided 60 by birthseconds(1 birth * 7.0 seconds), 60 by deathseconds, and 60 by immigrantseconds and so on.
Then, I calculated extra pop by adding birthminutes + immigrantminutes - deathminutes *60.0(1 hr) *24.0 (1 day) * 365 (1 year)
For the first year I did newpop1 = currentpop + extrapop, for newpop2 I did newpop1 + extrapop and so on. Basically I had to display the new population for each of the next five years.
 

DonMan

Well-Known Member
3,971
1,630
173
Joined
Sep 8, 2014
Hoopla Cash
$ 1,000.00
Fav. Team #1
Fav. Team #2
Fav. Team #3
I had to laugh - the more things change, the more they stay the same.

My introduction to programming was as part of honors Geometry in 10th grade, 1973. We learned to program in Fortran on an IBM 1130. It looked similar to the pictures here:
IBM 1130 - Wikipedia
Our computer had a card reader, console, line printer, 8K of memory, and a 1 meg hard drive. All programs had to be keyed onto punch cards, and then fed into the card reader, with the source printout and program output sent to the printer. Even the most minor of syntax errors would spit the whole thing out without any valid output. Everyone at first was overwhelmed by the tedium/detail involved in accomplishing the most minor of tasks.

I recommend you start by separating the logic required to solve your programming problem/assignment from the technical issues required to implement that logic. IOW, learn how to program "2+2=4", and then move onto more complex problems.

BTW, what do you mean by "drt situation"? Is that data retrieval tool?
 

Roy Munson

Posting with one hand
24,479
3,445
293
Joined
Jul 31, 2016
Location
Work
Hoopla Cash
$ 200.00
Fav. Team #1
Fav. Team #2
Fav. Team #3
why are you using decimal numbers when you should be using integer or long?
 

JohnShadows

Bayesian
Moderator
37,722
7,223
533
Joined
May 29, 2012
Location
Baker St.
Hoopla Cash
$ 706.71
Fav. Team #1
Fav. Team #2
Fav. Team #3
Java, C++, JS? What is the statement of the problem?
 

Roy Munson

Posting with one hand
24,479
3,445
293
Joined
Jul 31, 2016
Location
Work
Hoopla Cash
$ 200.00
Fav. Team #1
Fav. Team #2
Fav. Team #3
Java, C++, JS? What is the statement of the problem?

I haven't used C++ since college. Java has progressed so far, it would be tough to go back.
 

Gatorchip

Well-Known Member
20,090
2,310
173
Joined
Dec 22, 2009
Location
Boston
Hoopla Cash
$ 3,015.91
Fav. Team #1
Fav. Team #2
Fav. Team #3
His code is going to be packed with the random letter L
 

Brees#1

Well-Known Member
7,462
330
83
Joined
Jul 31, 2013
Hoopla Cash
$ 1,000.00
Fav. Team #1
Fav. Team #2
Fav. Team #3
I had to laugh - the more things change, the more they stay the same.

My introduction to programming was as part of honors Geometry in 10th grade, 1973. We learned to program in Fortran on an IBM 1130. It looked similar to the pictures here:
IBM 1130 - Wikipedia
Our computer had a card reader, console, line printer, 8K of memory, and a 1 meg hard drive. All programs had to be keyed onto punch cards, and then fed into the card reader, with the source printout and program output sent to the printer. Even the most minor of syntax errors would spit the whole thing out without any valid output. Everyone at first was overwhelmed by the tedium/detail involved in accomplishing the most minor of tasks.

I recommend you start by separating the logic required to solve your programming problem/assignment from the technical issues required to implement that logic. IOW, learn how to program "2+2=4", and then move onto more complex problems.

BTW, what do you mean by "drt situation"? Is that data retrieval tool?

Distance, rate, and time.
 

WizardHawk

Release the Kraken - Fuck the Canucks
51,918
12,481
1,033
Joined
Apr 17, 2013
Hoopla Cash
$ 8,800.06
Fav. Team #1
Fav. Team #2
Fav. Team #3
You guys ever play turtle?
I dabbled in programming in the Logo language back in the 80's. Turtle graphics could do some fairly complicated things easily, and made some easy things unnecessarily long.
 

Cobrabit

Resident Polymath
4,540
760
113
Joined
Apr 23, 2010
Location
VA
Hoopla Cash
$ 15,041.00
Fav. Team #1
Fav. Team #2
Fav. Team #3
Just started programming and fundamentals and already am overwhelmed.

For starters, I'm in pre-calc which covers some of this stuff in CS which I have yet to learn in pre-calc.

So I have never done minutes and seconds before in a drt situation. And then add kilos.

Anyway, here's what I did for my population
For minutes, I divided 60 by birthseconds(1 birth * 7.0 seconds), 60 by deathseconds, and 60 by immigrantseconds and so on.
Then, I calculated extra pop by adding birthminutes + immigrantminutes - deathminutes *60.0(1 hr) *24.0 (1 day) * 365 (1 year)
For the first year I did newpop1 = currentpop + extrapop, for newpop2 I did newpop1 + extrapop and so on. Basically I had to display the new population for each of the next five years.


I teach an introductory course with C++ and I tell my students that the best programmers aren't the ones that always know the correct/most direct path to an answer. They're the ones that will "beat their head on the wall" until that wall eventually breaks. Essentially, persistence and determination to keep working on it. As long as you don't "rage quit", you can take a break and come back to it with fresh eyes to eventually work through the problem.

Create your algorithm/flowchart on paper before you jump right into the coding, so you have your plan and determine if it'll actually work. Then convert the pseudo-code into whatever programming language you're using. Add output statements along the way when testing to see if you're getting the expected results for each small portion, which makes it easier to debug, then delete them once you've got it up and running.

Comments are your friend.

Good luck and keep with it!
 
Top