Author Topic: The programming help thread!  (Read 2187 times)

Necromancer

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 21366
Re: The programming help thread!
« Reply #15 on: June 04, 2007, 05:14:58 PM »
Where the f*ck did this thread come from? It just appeared out of the blue right before my eyes with 11 new messages. Now I know what stevek666 is talking about. To be honest, I just thought he was mental.

Great, now it's spreading.  Both nat and stevek666 are going nuckin' futs.

Around my office, I'm the boss.  Anyone caught posting on PCENGINEFX.COM during work hours (like I sometimes do) would immediately get a raise and promoted.  Sadly, no cool people work for me...

Are you hiring?  'Cause I'd be willing to relocate for some of this easy money.  :lol:
U.S. Collection: 97% complete    155/159 titles

Dark Fact

  • Hero Member
  • *****
  • Posts: 1147
Re: The programming help thread!
« Reply #16 on: June 04, 2007, 05:32:37 PM »
Quote from: nat
Yes, if it's as simple as what I think you're asking.

My entire job revolves around doing just that. That's right, I sit at a computer all day tabulating sales data and projecting sales and profit margins for the next week, month, and year. Then I devise new and illegal interesting ways to improve them. And in between when my boss isn't around I log on to www.pcenginefx.com/forums and make fun of people.

(Sales MTD / Days of month that have passed) * number of days in month

For example, to project sales for June as of right now, and assuming my MTD sales are $50,000:

(50,000 / 3 (technically the 4th day isn't over so we won't count it) ) * 30 (30 days in June) = a projection of $500,000 for the month.
The requirements for the question don't mention anything about specific days in a month.  The months are just given standard numbers from 1-6 since the question is for a six month projection.  Plus, there is the matter of growth rate percentages to deal with.  For instance, if the minimum assumed growth rate is 7%, then I need to post 6 month sales forecasts with the added growth rate percentage.  The growth rate goes up to a maximum of 4%.  So therefore, 7% would go to 11% or 5% would go to 9%.  I need a formula that disregards specific days in a month and takes into account growth rate percentages.

Sorry, but I don't see your library card on the books of Ys.  Now, RETURN THEM TO ME!!!

nat

  • Hero Member
  • *****
  • Posts: 7085
Re: The programming help thread!
« Reply #17 on: June 04, 2007, 05:39:06 PM »
The requirements for the question don't mention anything about specific days in a month.  The months are just given standard numbers from 1-6 since the question is for a six month projection.  Plus, there is the matter of growth rate percentages to deal with.  For instance, if the minimum assumed growth rate is 7%, then I need to post 6 month sales forecasts with the added growth rate percentage.  The growth rate goes up to a maximum of 4%.  So therefore, 7% would go to 11% or 5% would go to 9%.  I need a formula that disregards specific days in a month and takes into account growth rate percentages.

OK, well, that wasn't specified, but it changes everything. :) I knew it couldn't be as simple as that.

It would help me to see the actual text of the question, if it's not too much trouble...

Dark Fact

  • Hero Member
  • *****
  • Posts: 1147
Re: The programming help thread!
« Reply #18 on: June 05, 2007, 08:02:49 AM »
Sure, no problemo. :)

A paper products manufacturer needs a program to forecast its sales over a six-month period.  To do so requires knowing the value of the sales growth rate and how the sales grow over that period.  Write a program that asks the user to enter the minimum assumed growth rate (as a percent) and the sales for the current month.  Assume a linear growth, that is, the sales for a month equals a fixed percent (the growth rate) over the previous month.  The program should display, in a table, the projected sales for the minimum growth rate and for growth rates up to 4% greater than the minimum.  The table should look like the following, if the user enters 7 for the minimum growth rate and 30000 for the current month's sales.

Sales Projections
Current Month's Sales: 30000
Growth                                                                                   Month

Rate in %
1                2                3              4               5                6
7
8
9
10
11

NOTE: Month and growth are on the same line.  Stupid forum formatting or an optical illusion? :shock:
« Last Edit: June 05, 2007, 08:05:33 AM by Dark Fact »

Sorry, but I don't see your library card on the books of Ys.  Now, RETURN THEM TO ME!!!

Hobo Xiphas

  • Hero Member
  • *****
  • Posts: 529
Re: The programming help thread!
« Reply #19 on: June 05, 2007, 02:40:46 PM »
Use the code tag for preformatted stuff

offsidewing

  • Hero Member
  • *****
  • Posts: 631
Re: The programming help thread!
« Reply #20 on: June 05, 2007, 02:48:12 PM »
Around my office, I'm the boss.  Anyone caught posting on PCENGINEFX.COM during work hours (like I sometimes do) would immediately get a raise and promoted.  Sadly, no cool people work for me...

Are you hiring?  'Cause I'd be willing to relocate for some of this easy money.  :lol:

Actually, yes.  Two positions that I always snicker after reading.

Rack Coordinator.  Yes, you manage racks.

Packaging Engineer.  Help design a better package.

Snicker, Snicker.

Better have all your shit done when I catch you on PCENGINEFX.COM. 

nat

  • Hero Member
  • *****
  • Posts: 7085
Re: The programming help thread!
« Reply #21 on: June 05, 2007, 04:23:33 PM »
A paper products manufacturer needs a program to forecast its sales over a six-month period.  To do so requires knowing the value of the sales growth rate and how the sales grow over that period.  Write a program that asks the user to enter the minimum assumed growth rate (as a percent) and the sales for the current month.  Assume a linear growth, that is, the sales for a month equals a fixed percent (the growth rate) over the previous month.  The program should display, in a table, the projected sales for the minimum growth rate and for growth rates up to 4% greater than the minimum.  The table should look like the following, if the user enters 7 for the minimum growth rate and 30000 for the current month's sales.


OK, now I understand what they're getting at.

However, I get the impression you are looking for a single complex formula that can be used to calculate everything in that table. Since I'm no math major, I'm not sure I can help you there without spending a lot of time pondering over it. :(

I know the way *I* would do it which might be the "long way" around:

month1projection = ((currentsales)rate1  + currentsales)
month2projection = ((month1projection)rate1 + month1projection)
...
month6projection = ((month5projection)rate1 + month5projection)

then for the next tier down:

month1projectiontier2 = ((currentsales)rate2 + currentsales)
etc

and that's assuming:

currentsales = Current month's sales
rate1...rate5 = minimum growth rate...minimum growth rate+.04

It would be fairly simple for me to write a program to do what the question asks using the simple formulas here but that seems like it's got to be too easy. Plus the program would be fairly bloated. I might be able to figure it out if I spent a lot of time on it, but math is not one of my strengths, sadly. That's why you'll never find me without a calculator within arm's reach.

Dark Fact

  • Hero Member
  • *****
  • Posts: 1147
Re: The programming help thread!
« Reply #22 on: June 06, 2007, 07:53:53 AM »
Math's not my best subject either so you're not alone. :wink:

This is part of the chapter that requires the use of for loops to write your programs. *hint* *hint*

EDIT: I took your formulas to task and made this part of the loop body:

Code: [Select]
for (month_count = MONTH_START; month_count <= MONTH_END; month_count++)
              {
                   projected_sales = (current_month_sales * (percent_count / PCT_CONVERSION) + current_month_sales);
                   current_month_sales = projected_sales;
                   printf("  %6.2lf", projected_sales);
              }
The program outputs the projected sales results in "projected_sales" and then assigns the results into "current_month_sales".  The output is displayed afterwards.  Then, when "month_count" increments, "projected_sales" will be given a new value based on the newly assigned values in "current_month_sales".  Does this work?
« Last Edit: June 06, 2007, 08:03:55 AM by Dark Fact »

Sorry, but I don't see your library card on the books of Ys.  Now, RETURN THEM TO ME!!!

Kitsunexus

  • Hero Member
  • *****
  • Posts: 3911
Re: The programming help thread!
« Reply #23 on: June 06, 2007, 08:01:56 AM »
I'm so great at math I had to take remedial algebra and geometry and never got higher than C's.

This has no relevance to anything. Thank you. ;)

Necromancer

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 21366
Re: The programming help thread!
« Reply #24 on: June 06, 2007, 08:29:11 AM »
Better have all your shit done when I catch you on PCENGINEFX.COM. 

f*ck that noise!  I wanted to just roam pcenginefx.com all day and keep getting raises and promotions, but you'd actually expect me to work.  I'd only take the Packaging Engineer job if I could put my package in a giant cardboard box with an expanded polystyrene insert (damn, that sounds dirty too).
U.S. Collection: 97% complete    155/159 titles

Kitsunexus

  • Hero Member
  • *****
  • Posts: 3911
Re: The programming help thread!
« Reply #25 on: June 06, 2007, 09:41:19 AM »

offsidewing

  • Hero Member
  • *****
  • Posts: 631
Re: The programming help thread!
« Reply #26 on: June 07, 2007, 10:35:38 AM »
Better have all your shit done when I catch you on PCENGINEFX.COM. 

f*ck that noise!  I wanted to just roam pcenginefx.com all day and keep getting raises and promotions, but you'd actually expect me to work.  I'd only take the Packaging Engineer job if I could put my package in a giant cardboard box with an expanded polystyrene insert (damn, that sounds dirty too).

I'll tell you what.  I'll hire you as my admin, and you will be my PCENGINEFX.COM proxy poster.  Wait, no.  Cause then I'll have the ugliest admin in the building.  Hmmm...  I've got it.  I put you in logistics, but really, you'll spend your entire day keeping me apprised of all the posts in the forums.

"Hey, boss.  Nat just posted another thread saying that 'Spaceballs 3: The search for the second movie' makes for a better sequel than 'Big Trouble in Little Korea!'"

nat

  • Hero Member
  • *****
  • Posts: 7085
Re: The programming help thread!
« Reply #27 on: June 07, 2007, 12:30:48 PM »

"Hey, boss.  Nat just posted another thread saying that 'Spaceballs 3: The search for the second movie' makes for a better sequel than 'Big Trouble in Little Korea!'"


Well, it does.

Math's not my best subject either so you're not alone. :wink:

This is part of the chapter that requires the use of for loops to write your programs. *hint* *hint*

EDIT: I took your formulas to task and made this part of the loop body:

Code: [Select]
for (month_count = MONTH_START; month_count <= MONTH_END; month_count++)
              {
                   projected_sales = (current_month_sales * (percent_count / PCT_CONVERSION) + current_month_sales);
                   current_month_sales = projected_sales;
                   printf("  %6.2lf", projected_sales);
              }
The program outputs the projected sales results in "projected_sales" and then assigns the results into "current_month_sales".  The output is displayed afterwards.  Then, when "month_count" increments, "projected_sales" will be given a new value based on the newly assigned values in "current_month_sales".  Does this work?

Yeah, there you go. That works. What's next?

Dark Fact

  • Hero Member
  • *****
  • Posts: 1147
Re: The programming help thread!
« Reply #28 on: June 07, 2007, 01:01:40 PM »
That's what I thought.  Thanks for the help, nat.  I'll be sure to post here again when I need new help. :wink:

And Offsidewing, Kitsunexus, will you mind not spamming this thread? This is supposed to be a serious discussion thread from one fellow programmer to another.

Sorry, but I don't see your library card on the books of Ys.  Now, RETURN THEM TO ME!!!

Kitsunexus

  • Hero Member
  • *****
  • Posts: 3911
Re: The programming help thread!
« Reply #29 on: June 07, 2007, 02:07:02 PM »
13 posts are unrelated to the thread, in what was counted as a 29 post thread. That leaves us with 16 programming posts.


The law of the net says that in a thread hijack the predominant subject must be the one to continue on, so as you wish Dark Fact. I solemnly swear to leave this thread alone unless I have something related to programming to say.