major help needed with date problem

hi everyone, I have been working on this problem for so long, my brain is completely fried, really. the part of the project I have listed is just one of larger program that I have all figured out; this is the last part and I am just struggling to come up with a start. I think i need to use a for loop, but not quite sure.

HERE IS THE PROBLEM:

(2)Prompt the user for a premium amount (in dollars and cents, but assume the user does not enter the $ sign), a start date and an end date for a policy term, and an effective date for a policy cancellation. Dates should be entered with three separate prompts for year, month, and day, in that order. Month will be a number between 1 and 12, and year will have 4 digits. Assume any pair of dates is possible, between January 1, 1900 and December 31, 2200. You may assume that the user always enters a valid date. You may also assume that the user enters a start date that is before the end date. Assume the cancellation effective date is between the start and end dates. You may also assume that the premium amount the user enters is a valid number.

(5)Using the start date, end date, premium and a desired refund amount (entered by the user), calculate the cancellation effective date required to produce an amount equal to or slightly larger than the desired refund amount

if anyone is looking for some major duke stars, please post here . . .

[1420 byte] By [kalugaa] at [2007-11-26 19:56:02]
# 1

use timeStamp

import java.text.SimpleDateFormat;

{

.......

java.util.Date todayDate = new java.util.Date();

Timestamp tdate = new Timestamp(todayDate.getTime());

Simon83a at 2007-7-9 22:49:37 > top of Java-index,Java Essentials,New To Java...
# 2
ahh, man, I wish I could, but for this project, we can't use date or time objects; any other ideas?
kalugaa at 2007-7-9 22:49:37 > top of Java-index,Java Essentials,New To Java...
# 3
Do your own homework!
ChristopherAngela at 2007-7-9 22:49:37 > top of Java-index,Java Essentials,New To Java...
# 4
use regular expressions for ur problemgo for http://www.regular-expressions.info/examples.html
Simon83a at 2007-7-9 22:49:37 > top of Java-index,Java Essentials,New To Java...
# 5
> Do your own homework!i'm freakin' trying my best with the sleep I have (or don't have)at least Simon here is kind enough to point me in the right direction; note: i didn't ask for an answer, only some directionMessage was edited by: kaluga
kalugaa at 2007-7-9 22:49:38 > top of Java-index,Java Essentials,New To Java...
# 6
> use regular expressions for ur problem> go for> > > http://www.regular-expressions.info/examples.htmli'm not familiar with the term regular expressions - do you mean for, while, etc.?
kalugaa at 2007-7-9 22:49:38 > top of Java-index,Java Essentials,New To Java...
# 7
no. It deals with different validations like eg: email (whether u had entered a proper format of email( @ .com )) etc.
Simon83a at 2007-7-9 22:49:38 > top of Java-index,Java Essentials,New To Java...
# 8

> > use regular expressions for ur problem

> > go for

> >

> >

> > http://www.regular-expressions.info/examples.html

>

umm, I don't know how that site helped; I looked around and couldn't find what you were talking about that related to Java, could you be more specific as to where on the site?

kalugaa at 2007-7-9 22:49:38 > top of Java-index,Java Essentials,New To Java...
# 9

> no. It deals with different validations like eg:

> email (whether u had entered a proper format of

> email( @ .com )) etc.

proper format isn't an issue to me right now, and it isn't an issue on this problem, but thank you for your advice; I will remember that for the future

kalugaa at 2007-7-9 22:49:38 > top of Java-index,Java Essentials,New To Java...
# 10

Enter this code in servlet for validating emailID

Similarly what the url i had posted u , see it and use ur logic

Pattern pattern1=Pattern.compile(".+@.+\\.[a-z[A-Z]]+[com]");

Matcher matcher1=pattern1.matcher(req.getParameter("email"));

boolean found2=false;

while ( matcher1.find())

{

matcher1.group();matcher1.start();matcher1.end();

found2=true;

a3=req.getParameter("email");

}

Simon83a at 2007-7-9 22:49:38 > top of Java-index,Java Essentials,New To Java...
# 11

> Enter this code in servlet for validating emailID

> Similarly what the url i had posted u , see it and

> use ur logic

> > Pattern

> pattern1=Pattern.compile(".+@.+\\.[a-z[A-Z]]+[com]");

> Matcher

> matcher1=pattern1.matcher(req.getParameter("email"));

> boolean found2=false;

>

> while ( matcher1.find())

> {

> matcher1.group();matcher1.start();matcher1.end();

> found2=true;

>a3=req.getParameter("email");

> }

>

>

what? are we talking about the same thing? that makes no sense to me

kalugaa at 2007-7-9 22:49:38 > top of Java-index,Java Essentials,New To Java...
# 12

I don't know where all that business about regular expressions came from, I don't think it's related to your problem at all. But in future, if somebody should suggest using a regex to determine if an e-mail address is valid, don't pay any attention. The regexes they post are usually hopelessly lame, would reject a lot of valid addresses, and would allow a lot of invalid addresses. They aren't worth anything.

DrClapa at 2007-7-9 22:49:38 > top of Java-index,Java Essentials,New To Java...
# 13

> (5)Using the start date, end date, premium and a

> desired refund amount (entered by the user),

> calculate the cancellation effective date required to

> produce an amount equal to or slightly larger than

> the desired refund amount

Can you describe in precise detail--clear enough so that somebody who had no idea about this problem or the process could do it--the steps you'd take to do this without regard to Java?

jverda at 2007-7-9 22:49:38 > top of Java-index,Java Essentials,New To Java...
# 14

> > (5)Using the start date, end date, premium and a

> > desired refund amount (entered by the user),

> > calculate the cancellation effective date required

> to

> > produce an amount equal to or slightly larger than

> > the desired refund amount

>

> Can you describe in precise detail--clear enough so

> that somebody who had no idea about this problem or

> the process could do it--the steps you'd take to do

> this without regard to Java?

If I understand correctly, you need to find out what percentage of their policy they want to use (the refund they want back tells you what percentage of the premium they want back, so the rest is what they want to use). Then use that percentage to calculate the number of days they would have to use the policy to get that refund (you already know the total days, so total days * percentage = days until refund). Then you just need to find out what day is that many days after the start day. that would be when they would cancel. Hopefully that makes sense. I am still trying to have it make sense for me. I can't figure out how to code this.

kalugaa at 2007-7-9 22:49:38 > top of Java-index,Java Essentials,New To Java...