Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp

sandra baez

Greenhorn
+ Follow
since May 26, 2019
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by sandra baez

But what if the user uses 08 and 09. Then the program will fail
2 months ago
So how can I fix that. I tried with Integer.parseInt(theDay) but it doesnt work
2 months ago
Hi Im sorry I said it gives an error with 05. I checked and its after 8, for example 08, 09.
2 months ago

           
           
2 months ago
Hi. Thanks for your response. So do I put Integer.parseInt(theDay)? if I do that it says incompatible types. Sorry I'm new coding
2 months ago
Hi can you help me please?
I've been doing a Date program which is pretty much done except that when I introduce the month or the day with a zero in front, for example 05 it gives me the error "int number too large". What can I do about it and also if you have a better way to validate the year because I only have if theYear !=0  and that doesnt seem very good to me. Thank you!!



public void Date(  int theYear, int theMonth, int theDay)
                   {
                       // initialise instance variables
                       if (theYear !=0  && theMonth >0 && theMonth<13 && theDay !=0 && theDay>365){
                            throw new IllegalArgumentException("Please enter a valid date.");
                       } else{
                          year =  theYear;
                          day =   theDay;
                          month = theMonth;
                         
                       }
2 months ago
Hi. I figured it out!! Thank you!!
2 months ago
Hi. Can someone please tell me why some values such as firstName, bookGenre and weight are been stored as Null? I think firstName has no difference of lastName code so it should work properly but it doesnt.

2 months ago