•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 384,015 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,239 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Add n number of days to given date
public static void main(String args[]) throws Exception { SetTest st = new SetTest(); st.addDaysToDate("11/11/2007", 2); } private void addDaysToDate(String date, int daysToAdd) throws Exception { Date todayDate = new Date(); DateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); String strDate = sdf.format(todayDate); Date parsedDate = sdf.parse(date); System.out.println(strDate); System.out.println(parsedDate); Calendar now = Calendar.getInstance(); now.setTime(parsedDate); now.add(Calendar.DAY_OF_MONTH, daysToAdd); System.out.println(now.getTime()); }
Comments (Newest First)
frodo_cute21 | Newbie Poster | Apr 18th, 2008
•
•
•
•
hi! can you help me with my java programming?? plssssssssssssssssssss!!! im new to the java. here's my problem..
pls do solve my problem.. thanks!!!
hope to hear from you soon???
pls make the code.. god bless!!!
Activity 2
Place all the files in a folder named ClassList.
1. Design a class named Date with the following attributes: month, date and year which is all of type integer.
2. Design a class named Person with the following attributes: name and address both of type String and birthday of type Date.
3. Design a class named Student which is a Person with the following additional attributes: id and year both of type integer and school and course both of type String.
4. Write a class named ClassList which contains an array of Student with the maximum capacity of 100. It should also have the following method:
public boolean add(Student s)
-adds the student to the array
public boolean edit(Student s)
-edit the student’s entries in the array
public boolean delete(int id)
- delete the student with the matching id number in the array
public Student search(int id)
-search the student record in the array
public void display()
- shows all the records of the student in the array
5. Design a GUI for the class list that would allow the add, edit, delete, search and display of the students.
pls do solve my problem.. thanks!!!
hope to hear from you soon???
pls make the code.. god bless!!!
Activity 2
Place all the files in a folder named ClassList.
1. Design a class named Date with the following attributes: month, date and year which is all of type integer.
2. Design a class named Person with the following attributes: name and address both of type String and birthday of type Date.
3. Design a class named Student which is a Person with the following additional attributes: id and year both of type integer and school and course both of type String.
4. Write a class named ClassList which contains an array of Student with the maximum capacity of 100. It should also have the following method:
public boolean add(Student s)
-adds the student to the array
public boolean edit(Student s)
-edit the student’s entries in the array
public boolean delete(int id)
- delete the student with the matching id number in the array
public Student search(int id)
-search the student record in the array
public void display()
- shows all the records of the student in the array
5. Design a GUI for the class list that would allow the add, edit, delete, search and display of the students.
javaAddict | Posting Pro in Training | Jan 7th, 2008
•
•
•
•
I would have suggested for the user to give the date format as well. Or perhaps a try-catch with a throw inside the catch in case the user didn't enter a valid date.
Post Comment
•
•
•
•
DaniWeb Marketplace (Sponsored Links)