-
December 14th, 2010, 03:59 PM
#1
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
-
December 14th, 2010, 04:06 PM
#2
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
-
December 14th, 2010, 04:06 PM
#3
Re: Extremely amateur code write needs help with final due tonight please help i'm st
Heeeeeeeeellllllllllllpppppppppppppppp
-
December 14th, 2010, 05:10 PM
#4
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.
-
December 14th, 2010, 09:24 PM
#5
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.
-
December 15th, 2010, 02:46 AM
#6
Re: Extremely amateur code write needs help with final due tonight please help i'm st
Originally Posted by 99999
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
-
December 17th, 2010, 02:33 PM
#7
Re: Extremely amateur code write needs help with final due tonight please help i'm st
Originally Posted by memeloo
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|