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
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
Re: Extremely amateur code write needs help with final due tonight please help i'm st
Heeeeeeeeellllllllllllpppppppppppppppp
Re: Extremely amateur code write needs help with final due tonight please help i'm st
Quote:
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
Quote:
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.
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. :)
Re: Extremely amateur code write needs help with final due tonight please help i'm st
Quote:
Originally Posted by
99999
Plleeaasseee im going to fail i'm freaking outttttt
actually this is good news, more job opportunities for me :D
Re: Extremely amateur code write needs help with final due tonight please help i'm st
Quote:
Originally Posted by
memeloo
actually this is good news, more job opportunities for me :D
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 ;)