• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 03:20
CET 09:20
KST 17:20
  • 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
RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10
Community News
Weekly Cups (Nov 24-30): MaxPax, Clem, herO win2BGE Stara Zagora 2026 announced15[BSL21] Ro.16 Group Stage (C->B->A->D)4Weekly Cups (Nov 17-23): Solar, MaxPax, Clem win3RSL Season 3: RO16 results & RO8 bracket13
StarCraft 2
General
Chinese SC2 server to reopen; live all-star event in Hangzhou Maestros of the Game: Live Finals Preview (RO4) BGE Stara Zagora 2026 announced Weekly Cups (Nov 24-30): MaxPax, Clem, herO win SC2 Proleague Discontinued; SKT, KT, SGK, CJ disband
Tourneys
RSL Offline Finals Info - Dec 13 and 14! StarCraft Evolution League (SC Evo Biweekly) RSL Offline FInals Sea Duckling Open (Global, Bronze-Diamond) $5,000+ WardiTV 2025 Championship
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 502 Negative Reinforcement Mutation # 501 Price of Progress Mutation # 500 Fright night Mutation # 499 Chilling Adaptation
Brood War
General
BW General Discussion Which season is the best in ASL? Data analysis on 70 million replays BGH Auto Balance -> http://bghmmr.eu/ [ASL20] Ask the mapmakers — Drop your questions
Tourneys
[BSL21] RO16 Group D - Sunday 21:00 CET [BSL21] RO16 Group A - Saturday 21:00 CET [Megathread] Daily Proleagues [BSL21] RO16 Group B - Sunday 21:00 CET
Strategy
Current Meta Game Theory for Starcraft How to stay on top of macro? PvZ map balance
Other Games
General Games
Nintendo Switch Thread ZeroSpace Megathread Stormgate/Frost Giant Megathread The Perfect Game Path of Exile
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Mafia Game Mode Feedback/Ideas TL Mafia Community Thread
Community
General
Russo-Ukrainian War Thread US Politics Mega-thread Things Aren’t Peaceful in Palestine The Big Programming Thread Artificial Intelligence Thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
[Manga] One Piece Movie Discussion! Anime Discussion Thread
Sports
2024 - 2026 Football Thread Formula 1 Discussion NBA General Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Where to ask questions and add stream? The Automated Ban List
Blogs
Physical Exertion During Gam…
TrAiDoS
James Bond movies ranking - pa…
Topin
Thanks for the RSL
Hildegard
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1585 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
Poland17496 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
Poland17496 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
Hyrule19173 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
Hyrule19173 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
Replay Cast
00:00
WardiTV Mondays #62
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
SortOf 126
-ZergGirl 57
StarCraft: Brood War
Tasteless 260
Sacsri 110
Sharp 100
Pusan 90
Shine 63
Dewaltoss 55
ZergMaN 24
Bale 23
Shinee 10
sorry 9
[ Show more ]
Hm[arnc] 4
Dota 2
febbydoto187
NeuroSwarm112
canceldota31
League of Legends
JimRising 532
Reynor72
Counter-Strike
shoxiejesuss155
Super Smash Bros
Westballz20
Other Games
summit1g11020
WinterStarcraft563
crisheroes332
C9.Mang0289
Mew2King37
Organizations
Other Games
gamesdonequick592
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 14 non-featured ]
StarCraft 2
• Berry_CruncH208
• LUISG 5
• Light_VIP 2
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Lourlo1184
Upcoming Events
The PondCast
1h 41m
OSC
7h 41m
Demi vs Mixu
Nicoract vs TBD
Babymarine vs MindelVK
ForJumy vs TBD
Shameless vs Percival
Replay Cast
15h 41m
Korean StarCraft League
1d 18h
CranKy Ducklings
2 days
WardiTV 2025
2 days
SC Evo League
2 days
BSL 21
2 days
Sziky vs OyAji
Gypsy vs eOnzErG
OSC
2 days
Solar vs Creator
ByuN vs Gerald
Percival vs Babymarine
Moja vs Krystianer
EnDerr vs ForJumy
sebesdes vs Nicoract
Sparkling Tuna Cup
3 days
[ Show More ]
WardiTV 2025
3 days
OSC
3 days
BSL 21
3 days
Bonyth vs StRyKeR
Tarson vs Dandy
Replay Cast
4 days
Wardi Open
4 days
StarCraft2.fi
4 days
Monday Night Weeklies
4 days
Replay Cast
4 days
WardiTV 2025
5 days
StarCraft2.fi
5 days
PiGosaur Monday
5 days
StarCraft2.fi
6 days
Tenacious Turtle Tussle
6 days
Liquipedia Results

Completed

Proleague 2025-11-30
RSL Revival: Season 3
Light HT

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
YSL S2
BSL Season 21
CSCL: Masked Kings S3
Slon Tour Season 2
Acropolis #4 - TS3
META Madness #9
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2

Upcoming

BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
Kuram Kup
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
eXTREMESLAND 2025
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 © 2025 TLnet. All Rights Reserved.