Extremely amateur code write needs help with final due tonight please help i'm stresd
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: Extremely amateur code write needs help with final due tonight please help i'm stresd

  1. #1
    Join Date
    Nov 2010
    Posts
    13

    Angry Extremely amateur code write needs help with final due tonight please help i'm stresd

    Ok please help me with this, I have a final due tonight and I've tried to do this **** for like an hour now, but I have no idea how to do any of this **** with arrays and I've looked it up on the internet for like half an hour and nothing I've tried has worked.

    We have to use this header: public static int threshold (double [] gains, double goal)

    And this is the "psuedo-code" for part a:
    i. Set earned to 0
    ii. Set days to 0
    iii. While earned < goal and there are still elements left in the array:
    1. Add the next dayʼs increases to earned
    2. Add 1 to days
    3. Move to the next element in the array
    iv. Decide whether to return days or -1

    Then part b I have no idea about:

    Complete your program by writing a main() method that asks the user to enter a profit goal. You
    may define your own array of stock increase values. Your program should then calculate and print out the investment threshold for that profit goal, or state that the goal cannot be reached.

    So here's what I have so far:

    import java.util.*;
    public class investment_thresholds
    {
    public static int threshold (double [] gains, double goal)
    {
    gains = new double{5, 3, 6};
    int earned = 0;
    int days = 0;
    while (earned < goal)
    {
    earned = earned + gains;
    days = days + 1;
    }
    }
    }

    But pretty much the thing that isn't working and I have no ****ing clue about is the arrays!!! If you're going to reply 'do your own work' or something gay like that than go kill yourself because I tried this for like an hour and tried everything I could to get the ****ing **** to work and I can't do it because my fat **** teacher never taught us arrays! Any help whatsoever even the slightest bit is greaty appreciated

  2. #2
    Join Date
    Nov 2010
    Posts
    13

    Re: Extremely amateur code write needs help with final due tonight please help i'm st

    Plleeaasseee im going to fail i'm freaking outttttt

  3. #3
    Join Date
    Nov 2010
    Posts
    13

    Re: Extremely amateur code write needs help with final due tonight please help i'm st

    Heeeeeeeeellllllllllllpppppppppppppppp

  4. #4
    Join Date
    May 2006
    Location
    UK
    Posts
    4,474

    Re: Extremely amateur code write needs help with final due tonight please help i'm st

    If you're going to reply 'do your own work' or something gay like that than go kill yourself because I tried this for like an hour and tried everything I could to get the ****ing **** to work and I can't do it because my fat **** teacher never taught us arrays!
    Oh poor you wasting a whole hour on your homework. If you want help, my advice is don't start off being Mr Angry and insulting the people who can help you.

    Arrays are not difficult to use once you understand the basics and a quick google on using how to use arrays will bring up millions of hits sch as this tutorial

    Plleeaasseee im going to fail i'm freaking outttttt
    Not my problem. There are some lessons to be learned here: Don't leave your homework until the last minute and screaming and shouting doesn't help. If you had been politer in your first post you would have got a lot more help.
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

  5. #5
    Join Date
    Dec 2010
    Posts
    4

    Re: Extremely amateur code write needs help with final due tonight please help i'm st

    my data structure exam is a few hours away, LOL... you are not asking questions with the right attitude pal. Anyways good luck.

  6. #6
    Join Date
    Oct 2008
    Location
    Cologne, Germany
    Posts
    756

    Re: Extremely amateur code write needs help with final due tonight please help i'm st

    Quote Originally Posted by 99999 View Post
    Plleeaasseee im going to fail i'm freaking outttttt
    actually this is good news, more job opportunities for me
    win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming

    remeber to give feedback you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation

    private lessons are not an option so please don't ask for help in private, I won't replay

    if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know

  7. #7
    Join Date
    Feb 2008
    Posts
    966

    Re: Extremely amateur code write needs help with final due tonight please help i'm st

    Quote Originally Posted by memeloo View Post
    actually this is good news, more job opportunities for me
    Agreed, the last thing we need out there are more crappy developers.

    There are many lessons to be learned in life. Some of us have to learn the hard way

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center