Results 1 to 12 of 12

Thread: Vb

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2010
    Posts
    1

    Vb

    Write a program to complete the stated task:
    You are offered two salary options for ten days of work. Option 1: $100 per day. Option 2: $1 the first day, $2 the second day, $4 the third day, and so on, with the amount doubling each day. Write a program to determine which option pays better.

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Vb

    Thread moved from the 'CodeBank VB.Net' forum (which is for you to post working code examples, not questions) to the 'VB.Net' forum

  3. #3
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: Vb

    Quote Originally Posted by [email protected] View Post
    Please help with the above problem.
    What have you got so far? We are not just going to do your homework for you
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  4. #4
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,415

    Re: Vb

    Quote Originally Posted by [email protected] View Post
    Write a program to complete the stated task:
    You are offered two salary options for ten days of work. Option 1: $100 per day. Option 2: $1 the first day, $2 the second day, $4 the third day, and so on, with the amount doubling each day. Write a program to determine which option pays better.
    you'd use a for...loop to calculate option 2
    option 1 is just $100 * 10

    here's a clue - option 2 pays better

  5. #5

  6. #6
    Wait... what? weirddemon's Avatar
    Join Date
    Jan 2009
    Location
    USA
    Posts
    3,826

    Re: Vb

    Quote Originally Posted by Satal Keto View Post
    I love it when people post their homework and don't even bother to try and hide the fact that they're just copying and pasting the question.
    And then when they get the answer, they edit out all of their posts and ask others to do the same.

    Which means:

    QUOTE!!!!

    Quote Originally Posted by [email protected]
    Write a program to complete the stated task:
    You are offered two salary options for ten days of work. Option 1: $100 per day. Option 2: $1 the first day, $2 the second day, $4 the third day, and so on, with the amount doubling each day. Write a program to determine which option pays better.
    CodeBank contributions: Process Manager, Temp File Cleaner

    Quote Originally Posted by SJWhiteley
    "game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....

  7. #7
    Fanatic Member Satal Keto's Avatar
    Join Date
    Dec 2005
    Location
    Me.Location
    Posts
    518

    Re: Vb

    Quote Originally Posted by weirddemon View Post
    And then when they get the answer, they edit out all of their posts and ask others to do the same.

    Which means:

    QUOTE!!!!
    Ow yeah I forgot about them doing that, yeah that's annoying and totally defeats the purpose of a public forum.

  8. #8
    Stack Overflow mod​erator
    Join Date
    May 2008
    Location
    British Columbia, Canada
    Posts
    2,824

    Re: Vb

    I was the victim of one of those
    Hint 2: The second option can be calculated by adding together the powers of 2 from 0 to 9... and can be calculated in one line using LINQ.

  9. #9
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,415

    Re: Vb

    Quote Originally Posted by minitech View Post
    The second option can be calculated in one line using LINQ.
    go on then... i've got to see that

  10. #10
    Stack Overflow mod​erator
    Join Date
    May 2008
    Location
    British Columbia, Canada
    Posts
    2,824

    Re: Vb

    I can't say it here because it would give it away, but you use an array containing the numbers from 1 to 9 and a Select 2^x statement, then an Aggregate(Function(x As Integer, y As Integer) x + y).

  11. #11

  12. #12
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,415

    Re: Vb

    Quote Originally Posted by minitech View Post
    I can't say it here because it would give it away, but you use an array containing the numbers from 1 to 9 and a Select 2^x statement, then an Aggregate(Function(x As Integer, y As Integer) x + y).
    Quote Originally Posted by formlesstree4 View Post
    There's a handy feature called PM'ing
    yeah. PM me

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width