School Work

Date bluej programs ISC

date programs for bluej for ISC project or school work
of 23
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Related Documents
    QUESTION 24   Design a class to accept a date from the user and subtract n no. of days from it with the following details:- Class Name-Date1 Data Members- d, m, y, n of integer type Write the main function.       ALGORITHM Step 1:  Start   Step 2:  Declaring class Date1   Step 3:  Declaring d, m, y, c, n of integer type as data members   c 0 Step 4:  Creating main() in order to create the object of class Date1 in   order to call the member functions Printing enter the day, month and year Accepting day, month and year in variables d,m,y Printing enter the number of days to be subtracted Accepting the number of days in the variable n Declaring an integer array in a[] a[] {0,31,28,31,30,31,30,31,31,30,31,30,31} if(y%4==0&&y%100!=0)||(y%400==0) a[2] 29 while c<n d d-1 if d==0 m m-1 if m==0 y y-1 m 12 d a[m]   c c+1 Printing the date is: +d+ . +m+ . +y End if End if End while End of main() Step 5:  End    PROGRAM import*; class Date1 { private static BufferedReaderbr=new BufferedReader(new InputStreamReader(; public static void main(String args[])throws Exception { int d,m,y,c=0,n; //declaring variable as integers System.out.println( enter the day,month and year ); d=Integer.parseInt(br.readLine()); m=Integer.parseInt(br.readLine()); y=Integer.parseInt(br.readLine()); System.out.println( enter the number of days to be subtracted ); n=Integer.parseInt(br.readLine()); int a[]={0,31,28,31,30,31,30,31,31,30,31,30,31}; //creating aninteger array if((y%4==0&&y%100!=0)||(y%400==0)) a[2]=29;
Related Search
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks