Reputation: 2 Apprentice
- New Members
- Active Posts:
- 9 (0.01 per day)
- 19-June 11
- Profile Views:
- Last Active:
- Jan 20 2013 05:47 PM
- OS Preference:
- Favorite Browser:
- Favorite Processor:
- Favorite Gaming Platform:
- Your Car:
- Who Cares
- Dream Kudos:
Posts I've Made
Posted 25 Sep 2012Thanks to everyone who commented, I plan on using a combination of everything suggested to improve my algorithm, I'm especially interested in the sieve of eratosthenes.
Sent from my Nexus 7 using Tapatalk 2
Posted 19 Sep 2012You really don't need a loop for this program at all, just some arithmetic.
double hourlyWage = 12.00 //that's how much John makes an hour under working up to 40 hours double overtimeWage = 18.00 //that's how much he works when he goes over 40 hours double timeOnHourly = 40 //since John worked 45.5 hours, he only gets 40 hours on hourly wage double timeOnOvertime = 5.5 // the extra 5.5 hours gets overtime wage double grossPay = timeOnHourly*hourlyWage + timeOnOvertime*overtimeWage
Multiply the first two variables, and you get how much he made at 40 hours, then add the second two variables and you see how much he made at 45.5 hours.
Since John only gets to take home 71.5% of his gross pay though, we have to multiply his gross pay by that rate to get his net take-home pay. So...
double takeHomePay = grossPay*.715
Hope I could help, if you don't understand anything, please ask to me explain,as it's the concepts that are important, not the actual answer you get.
Posted 29 Nov 2011Yeah gonna have to agree with the other two on making some sort of deck class that handles the collection of cards. Then at the beginning of the deck class make the constructor run through and make an ordered deck. Also I'd make the values ints so you have an easier time if you plan on making some kind of game from this class.
Also if you do make a deck class collections.shuffle(deck) might spare you some trouble.
Posted 27 Nov 2011Ok, so for
//modify the next statement to instantiate an account object with the input information Account account = new Account("John Doe", 00001, 100, 1);All you have to do is take the information you've been given by the user at the beginning of the program and put them in the corresponding spots in the parameters. Not too hard so far.
System.out.print("What is the amount of the deposit? "); amount = s.nextDouble(); //process a deposit
For the above I'm guessing there's some method in account that you have to carry out like account.deposit(amount) or something along those lines. That shouldn't be too bad although you might have to make the method yourself. The next two comments will follow a similar procedure.
//add a transaction to the array of transactions
I don't see an array of transactions anywhere but you can make one by using your account class and just copying the values to the transaction account. Or make an entirely new class called transactions and go from there...As for this
while (day < 0 || day > 31); //modify the previous statement to use the days in the given month
I'm not exactly sure what she's asking, but it sounds like she doesn't want you accidentally putting 31 days in February or something. In which case you can just sort out which months have how many days and have something like
while( day > maxDayofMonth || day < minDayOfMonth) ...
although I'm not really sure what you're trying to accomplish by running that loop with days outside of the month because in your original you had days<0 which doesn't make sense if you're trying to get a day from within the month from the user. I also don't have a clue as to what the do-while loop is doing because you're not actually doing anything if the user gives more than 1 input. Yeah, so there's some logic errors it seems on top of what you have been given by you teacher. Either that or I'm just stupid and can't figure what's going on.
ps: You don't need
options = "DWAdwa";on line 24 because you already had it set to that in line 8.
Posted 25 Nov 2011Hey if there's still room open I'd love to join. Maybe we can get together on Google+ some time and hangout.
- Member Title:
- New D.I.C Head
- Age Unknown
- November 1