• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 02:58
CEST 08:58
KST 15:58
  • 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] Ro16 Preview: Rough Waters10[ASL22] Ro24 Preview: Siren's Call8[ASL22] Ro24 Preview: Summer's End9Serral wins HomeStory Cup 2915Serral wins Maestros of the Game 244
Community News
StarCraft open world shooter announced at BlizzCon55Weekly Cups (Aug 30-Sep 7): herO thrives amid growing schism10Official StarCraft website teases new content ahead of BlizzCon?166Stellar Fest TWO the Moon (Dec 16-20)9Weekly Cups (August 24-30): Patches' balance mod takes over3
StarCraft 2
General
StarCraft open world shooter announced at BlizzCon How do you feel about the StarCraft shooter announcement at BlizzCon 2026? Balance hotfix patch 5.0.16b (July 16) Team Liquid Map Contest #22: Results and Winners Weekly Cups (Aug 30-Sep 7): herO thrives amid growing schism
Tourneys
RSL goes to London! 2026 Offline Finals Nov 21-22 KSL Week #92 IntoTheTV X SOOP SC2 League : Weekly & Monthly 2026 GSTL Announcement Sparkling Tuna Cup - Weekly Open Tournament
Strategy
[G] Having the right mentality to improve
Custom Maps
Nexus Wars 2021 GUIDE [M] (2) Industrial Park
External Content
Mutation # 542 The Ascended Mutation # 541 Binary Choice The PondCast: SC2 News & Results Mutation # 540 Dodge This
Brood War
General
Official StarCraft website teases new content ahead of BlizzCon? BGH Auto Balance -> http://bghmmr.eu/ Broodwar Prediction Market Practice Partners (Official) [D] Brainstorming a balance patch for Brood war
Tourneys
[ASL22] Ro16 Group A [ASL22] Ro16 Group B Escore Tournament - Season 3 Small VOD Thread 2.0
Strategy
Replay Review Process - What do you do? Simple Questions, Simple Answers Odyssey Mineral Stack Saturation Game Theory for Starcraft
Other Games
General Games
Diablo IV EVE Corporation Nintendo Switch Thread [Maplestory Hardcore] Let's Play~!! General RTS Discussion Thread
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
[TL LoL EUW IHs] Teemo shall perish 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
Community
General
US Politics Mega-thread Trading/Investing Thread UK Politics Mega-thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread
Fan Clubs
MarineLorD Fan Club The Creator Fan Club The ShoWTimE Fan Club
Media & Entertainment
Diablo Animated Series on Netflix Movie Discussion!
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
The Automated Ban List Northern Ireland Global Starcraft
Blogs
Virtual Romance, Real-Life C…
TrAiDoS
Regacy Esports:Our Goa…
regacyesports
Dreaming of BW patches (mod…
c3rberUs
LOCKPICKING NOOB
LUCKY_NOOB
Customize Sidebar...

Website Feedback

Closed Threads



Active: 5571 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
Poland17843 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
Poland17843 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
Hyrule19254 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
Hyrule19254 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 3h 2m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
FoxeR 72
StarCraft: Brood War
Shuttle 4772
actioN 263
Stork 171
910 72
Aegong 55
yabsab 25
Dota 2
ODPixel386
NeuroSwarm163
Other Games
summit1g9821
JimRising 559
KnowMe100
RuFF_SC243
Organizations
Other Games
BasetradeTV236
[ Show 12 non-featured ]
StarCraft 2
• Berry_CruncH497
• Sammyuel 35
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• Migwel
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• lizZardDota2158
League of Legends
• Jankos1411
Upcoming Events
Sparkling Tuna Cup
3h 2m
WardiTV Invitational
4h 2m
ByuN vs Percival
Cure vs Classic
Shopify Rebellion Sundays
8h 2m
Spirit vs Mixu
Clem vs TBD
RSL Revival
9h 2m
Serral vs Rogue
BlizzCon
11h 32m
IdrA vs MC
Replay Cast
17h 2m
Afreeca Starleague
1d 3h
Light vs JyJ
Soulkey vs hero
WardiTV Weekly
1d 4h
Monday Night Weeklies
1d 9h
Afreeca Starleague
2 days
Snow vs Shinee
Shine vs EffOrt
[ Show More ]
GSL
2 days
PiGosaur Cup
2 days
The PondCast
3 days
Kung Fu Cup
3 days
Replay Cast
3 days
KCM Race Survival
4 days
IntoTheTV X SOOP
4 days
Replay Cast
4 days
IntoTheTV X SOOP
5 days
Replay Cast
5 days
GSL
6 days
Replay Cast
6 days
Liquipedia Results

Completed

Acropolis #5 - TRS
PiG Sty Festival 8.0
Big Dog Cup 2026 Div 1

Ongoing

KCM Race Survival 2026 Season 3
K-JUNGMAN
ASL Season 22
Super Anchor Qualifying S3
CSL 2026 AUTUMN (S22)
Acropolis #5
Blizzard Classic Cup 2026
Blizzard Classic Cup 2026
RSL Revival: Season 6
Calamity Invitational
FISSURE Playground #3
BLAST Open Fall 2026
Esports World Cup 2026
BLAST Bounty Summer 2026
BLAST Bounty Summer Qual
Stake Ranked Episode 3
XSE Pro League 2026

Upcoming

Acropolis #5 - GSA
Acropolis #5 - GSB
Acropolis #5 - GSC
SC4ALL II: Brood War
HSC XXX
Stellar Fest 2: Lunar Cup
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
RSL Offline Finals
PGL Major Singapore 2026
Stake Ranked Episode 6
BLAST Rivals Fall 2026
IEM Beijing 2026
Stake Ranked Episode 5
PGL Masters Bucharest 2026
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
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.