• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 17:57
CET 23:57
KST 07:57
  • 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
[ASL22] Finals Preview: Sweet Victory!12[ASL22] Ro4 Preview: Mirror Mirror6[ASL22] Ro8 Preview: Within Reach5[ASL22] Ro8 Preview: In A Tizzy11[ASL22] Ro16 Preview: Holy Diver5
Community News
Weekly Cups (Oct 26 - Nov 1): MaxPax, herO, Solar win0Weekly Cups (October 19-25): Clem triples first in 5.0.175Evil Geniuses - shutting down23ISSL (IntoTheTV x SOOP SC2 League): Premier7Weekly Cups (October 12-18): 5.0.17 era begins1
StarCraft 2
General
[D] Hacker peak in sc2 ? No more SC2 streamers on team liquid? Liquibets sc2 season 30 Evil Geniuses - shutting down Weekly Cups (Oct 26 - Nov 1): MaxPax, herO, Solar win
Tourneys
SC4ALL: II Venue Change Announcement! Sparkling Tuna Cup - Weekly Open Tournament WardiTV Mondays ISSL (IntoTheTV x SOOP SC2 League): Premier Stellar Fest TWO the Moon (Dec 16-20)
Strategy
[H] ZvP Mid-Late Game: Stalkers Collossi HT
Custom Maps
[G] How to playtest arcade maps Starcraft 2 Advance [D] the control group Simple Questions/Answers
External Content
Mutation # 550 Graveyard Shift The PondCast: SC2 News & Results Mutation # 549 Endless Sparkles Mutation # 548 Shining Bright
Brood War
General
BGH Auto Balance -> http://bghmmr.eu/ Rollback Netcode in Brood War SC4ALL: II Venue Change Announcement! Ziemie's Starcraft 1 Prequel Campaign 🇺🇦 Ukrainian StarCraft:BroodWar community reborn
Tourneys
[$1250] International ShieldBattery League [Megathread] Daily Proleagues Small VOD Thread 2.0 KCM Race Survival 2026 Season 4
Strategy
50,000-Word Terran Builds Memo 2026-10-22 Cliff Jump Revisited (1 in a 1000 strategy) Simple Questions, Simple Answers
Other Games
General Games
Nintendo Switch Thread Stormgate/Frost Giant Megathread Deus Ex 3!? Mobile Legends: Bang Bang Armies of Exigo - YesYes?
Dota 2
Dota 2 Champions League Season 3 Begins April 25!
League of Legends
[TL LoL EUW IHs] Teemo shall perish
Heroes of the Storm
Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
TL Mafia Community Thread
Community
General
US Politics Mega-thread Dating: How's your luck? Trading/Investing Thread Things Aren’t Peaceful in Palestine Canadian Politics Mega-thread
Fan Clubs
Fan Club Resource Thread Reynor Fan Club The Flash Fan Club
Media & Entertainment
Anime Discussion Thread Movie Discussion! [Manga] One Piece
Sports
Football (Soccer) Thread TeamLiquid Health and Fitness Initiative For 2023 MLB/Baseball 2023
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Recent Gifted Posts
Blogs
Why I built Repalyzer (1.1.…
BlueStar
Innovate or Game Over?
TrAiDoS
ShieldBattery on Mac
Kraekkling
[ASL22] Ro4 Day1 Ticket Giv…
bITt.mAN
Can Bots Beat Pros?? Starcr…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 14239 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
Poland17871 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
Poland17871 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
Hyrule19268 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
Hyrule19268 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 12h 3m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Nathanias 130
EmSc Tv 19
StarCraft: Brood War
Britney 8252
Shuttle 399
LuMiX 2
Dota 2
PGG 156
League of Legends
Doublelift4274
JimRising 593
Counter-Strike
jkaem39
Other Games
gofns10039
summit1g6005
Grubby2451
FrodaN888
shahzam434
PiGStarcraft321
C9.Mang0287
Liquid`Hasu262
syndereN166
Fuzer 155
XaKoH 124
NeuroSwarm77
ZombieGrub41
ViBE39
KnowMe33
JuggernautJason20
Railgan20
PPMD11
Organizations
Other Games
BasetradeTV167
Counter-Strike
PGL80
StarCraft 2
EmSc Tv 19
EmSc2Tv 19
[ Show 19 non-featured ]
StarCraft 2
• Hupsaiya 24
• Adnapsc2 20
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• Laughngamez YouTube
• Migwel
StarCraft: Brood War
• Azhi_Dahaki45
• HerbMon 28
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• WagamamaTV631
League of Legends
• Nemesis4167
• Jankos3568
• Scarra869
Other Games
• imaqtpie780
• Shiphtur211
Upcoming Events
IntoTheTV X SOOP
12h 3m
Reynor vs Solar
ByuN vs SHIN
Clem vs MaxPax
herO vs Rogue
IPSL
18h 3m
WorsT vs nOmaD
Dewalt vs andersOn
AI Arena Tournament
20h 3m
IntoTheTV X SOOP
1d 12h
IPSL
1d 18h
Azhi_Dahaki vs ggnore13
Double vs WIZARD
Replay Cast
2 days
Replay Cast
3 days
Sparkling Tuna Cup
3 days
WardiTV Invitational
3 days
YoungYakov vs Lambo
SHIN vs TBD
Percival vs Shameless
Solar vs TBD
PiGosaur Cup
4 days
[ Show More ]
The PondCast
5 days
KCM Race Survival
5 days
WardiTV Invitational
5 days
Liquipedia Results

Completed

Proleague 2026-11-05
Blizzard Classic Cup 2026
HCC Season 3

Ongoing

Acropolis #5
KCM Race Survival 2026 Season 4
International ShieldBattery League
BSL Season 23
IPSL Winter 2026-27
Calamity Cup Div. A Season 8
IEM Beijing 2026
PGL Masters Bucharest 2026
Stake Ranked Episode 5
1win Private Club #2
Thunderpick World Champ. '26
ESL Pro League Season 24
Stake Ranked Episode 4
1win Private Club #1
Logitech G Play Connect 2026
SL StarSeries Fall 2026
FISSURE Playground #3
BLAST Open Fall 2026

Upcoming

Sector 951
SC4ALL II: Brood War
BSL 23: Non-Korean Championship
HSC XXX
Stellar Fest 2: Lunar Cup
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
RSL Offline Finals
Underdog Cup 2026 Div 2-3
PGL Bucharest 2027
BLAST Bounty Winter 2027
eXTREMESLAND 2026
PGL Major Singapore 2026
Stake Ranked Episode 6
BLAST Rivals Fall 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.