• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 16:18
CEST 22:18
KST 05:18
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
Serral wins HomeStory Cup 2914Serral wins Maestros of the Game 243ByuL, and the Limitations of Standard Play3Team Liquid Map Contest #22: Results and Winners7Code S Season 2 (2026): RO4 and Finals Preview12
Community News
IntoTheTV X SOOP SC2 League : Weekly & Monthly4Clem: "I don't have that much hope in Blizzard"2ZeroSpace Early Access is Now Live!25Weekly Cups (July 13-19): Terran & Protoss rise; Zerg falters2Balance hotfix patch 5.0.16b (July 16)90
StarCraft 2
General
What's the best tug of war? Reynor: GSL Loss Wasn't About Preparation Format Balance hotfix patch 5.0.16b (July 16) How would you feel about frequent/monthly balance patches for SC2? Clem: "I don't have that much hope in Blizzard"
Tourneys
IntoTheTV X SOOP SC2 League : Weekly & Monthly INu's Battles#18 - Cure, herO, Rogue & ByuN RSL Revival: Season 6 - Qualifiers and Main Event Master Swan Open (Global Bronze-Master 2) WardiTV Summer Cup 2026
Strategy
[G] Having the right mentality to improve
Custom Maps
[M] (2) Industrial Park New Map Maker - Looking for Advice - Love or Hate
External Content
Mutation # 535 Assembly of Vengeance The PondCast: SC2 News & Results Mutation # 534 Burning Evacuation Mutation # 533 Die Together
Brood War
General
BGH Auto Balance -> http://bghmmr.eu/ ASL22 General Discussion BW General Discussion How Famous was FlaSh before his Debut? Animated Gateway
Tourneys
Escore Tournament - Season 3 Small VOD Thread 2.0 [Megathread] Daily Proleagues [IPSL] Spring 2026 Grand Finals - This Weekend!
Strategy
Simple Questions, Simple Answers PvT advise for noobs Fighting Spirit mining rates Creating a full chart of Zerg builds
Other Games
General Games
ZeroSpace Early Access is Now Live! Path of Exile General RTS Discussion Thread Nintendo Switch Thread Diablo IV
Dota 2
Looking for a Dota Mentor Official 'what is Dota anymore' discussion
League of Legends
TSM pausing esports and CLG Dead
Heroes of the Storm
Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
TL Mafia Community Thread TL Mafia Power Rank NeO.D_StephenKing vs This Guy From 1 Million Dance Vanilla Mini Mafia
Community
General
US Politics Mega-thread Artificial Intelligence Thread Russo-Ukrainian War Thread How to buy a book - shipping from Korea to Europe The Games Industry And ATVI
Fan Clubs
The IdrA Fan Club The HerO Fan Club!
Media & Entertainment
Anime Discussion Thread Series you have seen recently... Movie Discussion! [Req][Books] Good Fantasy/SciFi books
Sports
TeamLiquid Health and Fitness Initiative For 2023 2024 - 2026 Football Thread Formula 1 Discussion MLB/Baseball 2023 McBoner: A hockey love story
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread Simple Questions Simple Answers FPS when play League Of Legend on laptop
TL Community
Northern Ireland Global Starcraft The Automated Ban List
Blogs
How Games can Help with Majo…
TrAiDoS
Hello guys!
LIN1s
ASL S22 English Commentary…
namkraft
Poker (part 2)
Nebuchad
An Exploration of th…
waywardstrategy
Customize Sidebar...

Website Feedback

Closed Threads



Active: 4642 users

The Big Programming Thread - Page 524

Forum Index > General Forum
Post a Reply
Prev 1 522 523 524 525 526 1032 Next
Thread Rules
1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution.
2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20)
3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible.
4. Use [code] tags to format code blocks.
beachbeachy
Profile Blog Joined June 2011
United States509 Posts
September 29 2014 04:34 GMT
#10461
Hey guys, currently in intro to CS and I have a quick question. The teacher asks us to find the input, output, transformation, and constraints for this problem so we can write a psedu code

Problem: A program needs to be written to compute a wage calculation for a company which has 50 employees. Calculation needs to be based on the following specifications:
-Work hours, 40-60
-Tax rate 30%
-Overtime count (1 1/2)
-Different hourly rate

Here's what I have so far.

Input phase: Work hours, tax rate, overtime, hourly rate, how many employees.
Output phase: Total hours, tax on employees, money spent on employees.
Transformation: pretax=(hours)+(overtimeHours*1.5)
cost=pretax*taxpercentage
Constraints: ????

My teacher was very vague at explaining this and all my answers are but a shot in the dark. If anyone could lend some assistance to this budding programmer, that would be much appreciated ^_^

Dream no small dreams for they have no power to move the hearts of men. - Goethe
icystorage
Profile Blog Joined November 2008
Jollibee19350 Posts
September 29 2014 14:20 GMT
#10462
how bout leaves or AWOL? does that take into consideration?
LiquidDota StaffAre you ready for a Miracle-? We are! The International 2017 Champions!
Rotodyne
Profile Blog Joined July 2005
United States2263 Posts
September 29 2014 15:53 GMT
#10463
if (workplace_explosion == true)
end program
I can only play starcraft when I am shit canned. IPXZERG is a god.
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
September 29 2014 16:47 GMT
#10464
If you're confused all they're saying is that your question is way too broad and non-specific to answer.
There is no one like you in the universe.
Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
Last Edited: 2014-09-29 17:24:54
September 29 2014 17:24 GMT
#10465
--- Nuked ---
beachbeachy
Profile Blog Joined June 2011
United States509 Posts
September 29 2014 22:50 GMT
#10466
On September 30 2014 02:24 Nesserev wrote:

while (true)
{
try_to_understand_question
}

Seriously though...

input
The tax rate is the same for everyone (30%) and thus representable by a simple number, but you'll need lists/arrays containing the workhours, overtime counts and hourly rates for every worker(index), because these can be different for every employee. You do not need a number that explicitely says how many employees there are per se, because this is implicitely given by the lenght of every array.

One first 'constraint' is that every array has to have the same length!
Second constraint is the fact that the amount of work hours per person has to be between 40-60.

Input phase: array_workhours, taxrate, array_overtimecount, array_hourlyrate

Output
If the program is supposed to calculate the 'total' wages that the company has to pay the output is simply one number, the total amount of wages that have to be paid.

If the program is supposed to calculate the wages per person, then you have to return an array with the post-taxation wages of every person(index).

Third constraint is that the array_costs has to be the same lenght as the arrays used for the input.

Output phase: array_costs or totalcost

Transformation

// for every person: calculate cost
pretax = hours * hourlyrate + (overtimeHours * 1.5 ) * hourlyrate
cost = pretax + (pretax * taxpercentage)

// append cost to array_costs, or add cost to total_costs

It's not clear how the wages are actually calculated, especially the taxes. Are these taxes that the people have to pay, or the company? Better check these formulas again.

constraints
- every array in input has to have the same length
- work hours per person have to be between 40-60
- output_array has to have the same length as the arrays from the input


Thank you so much kind sir. Cleared it up nicely for me.
Dream no small dreams for they have no power to move the hearts of men. - Goethe
Ninoah
Profile Joined August 2014
7 Posts
October 01 2014 04:01 GMT
#10467
Quick question: Referencing http://bigocheatsheet.com/ under Data Structures.

What is a "indexing" operation?

meatpudding
Profile Joined March 2011
Australia520 Posts
October 01 2014 04:12 GMT
#10468
On October 01 2014 13:01 Ninoah wrote:
Quick question: Referencing http://bigocheatsheet.com/ under Data Structures.

What is a "indexing" operation?



I believe it means grabbing an element out of the structure. e.g. for a simple array, indexing the element a[100] is O(1), but for a list it is O(n) because you have to traverse the list, etc.
Be excellent to each other.
Manit0u
Profile Blog Joined August 2004
Poland17800 Posts
October 01 2014 15:52 GMT
#10469
Do any of you have experience with jQuery cookies?


$.cookie('var', 'val'); // throws uncaught reference error since scripts are being loaded at the bottom of the page

// after finally setting the cookie and testing it in the console (invoking $.cookie('var') returns "val")

window.onload = function () { // need onload to wait for jQuery
if ($.cookie('var') === "val") {
// can't even test this because the browser crashes before being able to load the page with this code
}
}


Any ideas?
Time is precious. Waste it wisely.
RoyGBiv_13
Profile Blog Joined August 2010
United States1275 Posts
October 01 2014 17:50 GMT
#10470
On October 01 2014 13:12 meatpudding wrote:
Show nested quote +
On October 01 2014 13:01 Ninoah wrote:
Quick question: Referencing http://bigocheatsheet.com/ under Data Structures.

What is a "indexing" operation?



I believe it means grabbing an element out of the structure. e.g. for a simple array, indexing the element a[100] is O(1), but for a list it is O(n) because you have to traverse the list, etc.


+1, good explanation
Any sufficiently advanced technology is indistinguishable from magic
YourGoodFriend
Profile Blog Joined June 2010
United States2197 Posts
October 01 2014 18:03 GMT
#10471
On October 02 2014 00:52 Manit0u wrote:
Do any of you have experience with jQuery cookies?


$.cookie('var', 'val'); // throws uncaught reference error since scripts are being loaded at the bottom of the page

// after finally setting the cookie and testing it in the console (invoking $.cookie('var') returns "val")

window.onload = function () { // need onload to wait for jQuery
if ($.cookie('var') === "val") {
// can't even test this because the browser crashes before being able to load the page with this code
}
}


Any ideas?


Are those comments your question? I am confused as to what you are asking?
anonymous is the most famous author that anyone can be
Manit0u
Profile Blog Joined August 2004
Poland17800 Posts
Last Edited: 2014-10-01 19:43:05
October 01 2014 19:41 GMT
#10472
Oh, forgot to ask the actual question

I need to store a global JS variable on page refresh and execute a script based off of that (this way I'll have to do minimal changes to huge application that's actually live). The problem I'm facing is that something seemingly simple - like storing/getting single value via cookie - is crashing the browser...

Do you know of other ways of doing it? Or making this work?
Time is precious. Waste it wisely.
YourGoodFriend
Profile Blog Joined June 2010
United States2197 Posts
October 01 2014 19:54 GMT
#10473
On October 02 2014 04:41 Manit0u wrote:
Oh, forgot to ask the actual question

I need to store a global JS variable on page refresh and execute a script based off of that (this way I'll have to do minimal changes to huge application that's actually live). The problem I'm facing is that something seemingly simple - like storing/getting single value via cookie - is crashing the browser...

Do you know of other ways of doing it? Or making this work?


Ok cool yeah you can use plan ol' javascript to do this.

document.cookie="username=John Doe; expires=Thu, 18 Dec 2013 12:00:00 UTC; path=/";

to get this cookie

var oreo = document.cookie;

to change the cookie that is already there you do the same as setting it

document.cookie="username=Jane Doe; expires=Thu, 18 Dec 2014 12:00:00 UTC; path=/";

go here for more info:
http://www.w3schools.com/js/js_cookies.asp

Hope this helps!
anonymous is the most famous author that anyone can be
tofucake
Profile Blog Joined October 2009
Hyrule19229 Posts
October 01 2014 22:38 GMT
#10474
we don't talk about w3schools around here
Liquipediaasante sana squash banana
YourGoodFriend
Profile Blog Joined June 2010
United States2197 Posts
October 01 2014 23:46 GMT
#10475
On October 02 2014 07:38 tofucake wrote:
we don't talk about w3schools around here


Well for JavaScript Mozilla documentation is definitely better. But w3 isn't too bad
anonymous is the most famous author that anyone can be
MysteryMeat1
Profile Blog Joined June 2011
United States3292 Posts
October 02 2014 00:17 GMT
#10476
In class, we have been going over ArrayLists for java. Something that really confuses me, is how exactly do arraylists store inputs?

if we have to create a 26 sized array and count how many times a letter shows up in a sentence, do we go through the process of using a counter? or do we just keep adding 1 to that section? I've been reading the book and going over lecture notes but im still unsure of how arraylists work.
"Cause ya know, Style before victory." -The greatest mafia player alive
berated-
Profile Blog Joined February 2007
United States1134 Posts
October 02 2014 00:22 GMT
#10477
On October 02 2014 04:41 Manit0u wrote:
Oh, forgot to ask the actual question

I need to store a global JS variable on page refresh and execute a script based off of that (this way I'll have to do minimal changes to huge application that's actually live). The problem I'm facing is that something seemingly simple - like storing/getting single value via cookie - is crashing the browser...

Do you know of other ways of doing it? Or making this work?


Why does it have to happen on the unload? Why don't you store the value when it changes to make sure that you aren't waiting until the very end? Have you tried modifying the cookie anywhere other than unload? Does it still crash the browser? Is this the first time you are trying to modify the cookie, you aren't trying to set it on the server first? It's not marked as http only, is it?

I've used jQuery to modify cookies but never seen it crash.

As far as the general solution idea, I think you'd have to get a bit more specific about the problem before anyone could help or judge.
tofucake
Profile Blog Joined October 2009
Hyrule19229 Posts
October 02 2014 01:03 GMT
#10478
On October 02 2014 08:46 YourGoodFriend wrote:
Show nested quote +
On October 02 2014 07:38 tofucake wrote:
we don't talk about w3schools around here


Well for JavaScript Mozilla documentation is definitely better. But w3 isn't too bad

http://www.w3fools.com/
Liquipediaasante sana squash banana
YourGoodFriend
Profile Blog Joined June 2010
United States2197 Posts
October 02 2014 01:11 GMT
#10479
On October 02 2014 10:03 tofucake wrote:
Show nested quote +
On October 02 2014 08:46 YourGoodFriend wrote:
On October 02 2014 07:38 tofucake wrote:
we don't talk about w3schools around here


Well for JavaScript Mozilla documentation is definitely better. But w3 isn't too bad

http://www.w3fools.com/


Oh I understand that mdn is the place to go, it's what I use when looking up anything ecma5 related. But I find that it can be a bit much for non-developers and simple JavaScript (emca3 and back )is usually easy to see and understand on w3.
anonymous is the most famous author that anyone can be
rebdomine
Profile Blog Joined October 2010
6040 Posts
October 02 2014 01:12 GMT
#10480
On October 02 2014 09:17 MysteryMeat1 wrote:
In class, we have been going over ArrayLists for java. Something that really confuses me, is how exactly do arraylists store inputs?

if we have to create a 26 sized array and count how many times a letter shows up in a sentence, do we go through the process of using a counter? or do we just keep adding 1 to that section? I've been reading the book and going over lecture notes but im still unsure of how arraylists work.


You could iterate through your ArrayList in 3 ways:
1. convert it to a plain array and loop like you would an array (which you seem to already know)
2. use a foreach loop to go through your list, the syntax would be something like:
for (Object a : ArrayList<Object> b)

3. use a ListIterator (you should only use this over foreach if you are going to be modifying the contents of your list as you go through it)
"Just because you are correct doesn't mean you are right!"
Prev 1 522 523 524 525 526 1032 Next
Please log in or register to reply.
Live Events Refresh
Next event in 1h 42m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
mouzHeroMarine 364
ZombieGrub239
ProTech95
Counter-Strike
fl0m3758
Heroes of the Storm
Liquid`Hasu478
Other Games
tarik_tv4910
Grubby3814
singsing1550
shahzam1024
B2W.Neo236
C9.Mang0188
UpATreeSC161
ArmadaUGS128
hungrybox88
JuggernautJason85
QueenE77
Livibee60
Trikslyr54
SteadfastSC20
Organizations
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 16 non-featured ]
StarCraft 2
• intothetv
• AfreecaTV YouTube
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• blackmanpl 48
• FirePhoenix9
• iopq 1
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Other Games
• imaqtpie729
• Shiphtur610
• Scarra269
Upcoming Events
OSC
1h 42m
Replay Cast
4h 12m
Korean StarCraft League
6h 42m
Afreeca Starleague
7h 42m
RSL Revival
12h 42m
Serral vs SHIN
herO vs Solar
Online Event
18h 42m
RSL Revival
1d 12h
Clem vs ByuN
Rogue vs Lambo
OSC
1d 15h
WardiTV Weekly
2 days
Sparkling Tuna Cup
3 days
[ Show More ]
INu's Battles
3 days
Cure vs herO
ByuN vs Rogue
PiGosaur Cup
4 days
The PondCast
4 days
Kung Fu Cup
4 days
Patches Events
4 days
Replay Cast
5 days
CrankTV Team League
5 days
Replay Cast
6 days
CrankTV Team League
6 days
Liquipedia Results

Completed

Proleague 2026-07-22
HSC XXIX
Eternal Conflict S2 E3

Ongoing

CSL 2026 Summer (S21)
KCM Race Survival 2026 Season 3
Escore Tournament S3: W4
RSL Revival: Season 6
CranK Gathers Season 4: BW vs SC2 Team League
SCTL 2026 Spring
BLAST Bounty Summer Qual
Stake Ranked Episode 3
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 2026
PGL Astana 2026

Upcoming

ASL S22 SEASON OPEN Day 2
Escore Tournament S3: W5
ASL Season 22: Qualifier #1
ASL Season 22: Qualifier #2
CSLAN 4
ASL Season 22
Blizzard Classic Cup 2026
HSC XXX
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
Light Tournament 2026
Eternal Conflict S2 Finale
ESL Pro League Season 24
Stake Ranked Episode 4
Logitech G Connect 2026
SL StarSeries Fall 2026
FISSURE Playground #5
BLAST Open Fall 2026
Esports World Cup 2026
BLAST Bounty Summer 2026
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2026 TLnet. All Rights Reserved.