• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 16:23
CEST 22:23
KST 05:23
  • 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
Code S Season 1 - RO8 Preview5[ASL21] Ro8 Preview Pt2: Progenitors8Code S Season 1 - RO12 Group A: Rogue, Percival, Solar, Zoun13[ASL21] Ro8 Preview Pt1: Inheritors16[ASL21] Ro16 Preview Pt2: All Star10
Community News
Maestros of The Game 2 announcement and schedule !7Weekly Cups (April 27-May 4): Clem takes triple0RSL Revival: Season 5 - Qualifiers and Main Event12Code S Season 1 (2026) - RO12 Results12026 GSL Season 1 Qualifiers25
StarCraft 2
General
Code S Season 1 - RO8 Preview Behind the Blue - Team Liquid History Book Weekly Cups (April 27-May 4): Clem takes triple Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool Code S Season 1 (2026) - RO12 Results
Tourneys
Sparkling Tuna Cup - Weekly Open Tournament Sea Duckling Open (Global, Bronze-Diamond) Maestros of The Game 2 announcement and schedule ! GSL Code S Season 1 (2026) RSL Revival: Season 5 - Qualifiers and Main Event
Strategy
Custom Maps
[D]RTS in all its shapes and glory <3 [A] Nemrods 1/4 players
External Content
Mutation # 524 Death and Taxes The PondCast: SC2 News & Results Mutation # 523 Firewall Mutation # 522 Flip My Base
Brood War
General
Quality of life changes in BW that you will like ? BGH Auto Balance -> http://bghmmr.eu/ RepMastered™: replay sharing and analyzer site Tulbo's ASL S21 Ro8 Post-Review Why there arent any 256x256 pro maps?
Tourneys
[ASL21] Ro8 Day 4 Escore Tournament StarCraft Season 2 [Megathread] Daily Proleagues Small VOD Thread 2.0
Strategy
Simple Questions, Simple Answers Fighting Spirit mining rates What's the deal with APM & what's its true value Any training maps people recommend?
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread Daigo vs Menard Best of 10 Path of Exile OutLive 25 (RTS Game)
Dota 2
The Story of Wings Gaming
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
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas TL Mafia Community Thread Five o'clock TL Mafia
Community
General
US Politics Mega-thread The Letting Off Steam Thread European Politico-economics QA Mega-thread UK Politics Mega-thread Canadian Politics Mega-thread
Fan Clubs
The IdrA Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [Req][Books] Good Fantasy/SciFi books
Sports
2024 - 2026 Football Thread McBoner: A hockey love story Formula 1 Discussion
World Cup 2022
Tech Support
streaming software Strange computer issues (software) [G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
How EEG Data Can Predict Gam…
TrAiDoS
ramps on octagon
StaticNine
Funny Nicknames
LUCKY_NOOB
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1215 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
Poland17743 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
Poland17743 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
Hyrule19210 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
Hyrule19210 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
BSL
19:00
RO16 Group C
Artosis vs TerrOr
spx vs StRyKeR
ZZZero.O370
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
mouzHeroMarine 465
BRAT_OK 56
CosmosSc2 50
Vindicta 26
PattyMac 13
StarCraft: Brood War
Calm 3918
Mini 404
ZZZero.O 370
ggaemo 232
firebathero 152
Dewaltoss 135
Backho 37
Hyun 28
NaDa 4
Dota 2
monkeys_forever1056
LuMiX1
League of Legends
Doublelift1749
JimRising 133
Reynor67
Counter-Strike
Fnx 1896
Heroes of the Storm
Liquid`Hasu372
Khaldor228
Other Games
Grubby4970
FrodaN2549
fl0m1250
KnowMe265
RotterdaM228
Hui .189
kaitlyn45
Organizations
Other Games
gamesdonequick3519
StarCraft 2
angryscii 18
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 23 non-featured ]
StarCraft 2
• Hupsaiya 69
• printf 59
• davetesta28
• Adnapsc2 22
• Response 2
• IndyKCrew
• sooper7s
• AfreecaTV YouTube
• Migwel
• intothetv
• LaughNgamezSOOP
• Kozan
StarCraft: Brood War
• FirePhoenix10
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• WagamamaTV913
• masondota2739
• lizZardDota280
League of Legends
• imaqtpie2115
• TFBlade918
Other Games
• Shiphtur269
• tFFMrPink 20
Upcoming Events
Replay Cast
3h 37m
Sparkling Tuna Cup
13h 37m
RSL Revival
13h 37m
Cure vs Zoun
Clem vs Lambo
WardiTV Invitational
15h 37m
ByuN vs Rogue
Solar vs Ryung
Zoun vs Percival
Cure vs SHIN
BSL
22h 37m
Dewalt vs DragOn
Aether vs Jimin
GSL
1d 11h
Afreeca Starleague
1d 13h
Soma vs Leta
Wardi Open
1d 15h
Monday Night Weeklies
1d 19h
OSC
2 days
[ Show More ]
CranKy Ducklings
2 days
Afreeca Starleague
2 days
Light vs Flash
Replay Cast
3 days
Replay Cast
4 days
The PondCast
4 days
Replay Cast
5 days
RSL Revival
5 days
Korean StarCraft League
6 days
RSL Revival
6 days
BSL
6 days
Liquipedia Results

Completed

Escore Tournament S2: W6
WardiTV TLMC #16
Nations Cup 2026

Ongoing

BSL Season 22
ASL Season 21
CSL 2026 SPRING (S20)
IPSL Spring 2026
KCM Race Survival 2026 Season 2
Acropolis #4
KK 2v2 League Season 1
SCTL 2026 Spring
RSL Revival: Season 5
2026 GSL S1
PGL Astana 2026
BLAST Rivals Spring 2026
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2

Upcoming

BSL 22 Non-Korean Championship
YSL S3
Escore Tournament S2: W7
Escore Tournament S2: W8
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
Maestros of the Game 2
2026 GSL S2
BLAST Bounty Summer 2026: Closed Qualifier
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
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.