Page 648 - Computer science 868 Class 12
P. 648

38                       {

                39                           filstr += (char)j;
                40                       }

                41                   }
                42               }

                43               filstr += sortedStr.charAt(sortedStr.length() - 1);
                44               System.out.println("Filled String:");

                45               System.out.println(filstr);
                46           }

                47       }

              Output of the preceding program is as follows:
              Enter a string:
              India is great

              Alphabetical order:
              aadegiiinrst

              Filled String:
              aabcdefghiiijklmnopqrst


                Program 30     Design a class Ddate that takes a future date(any date after 01-01-2019) and prints what day
                               it will be(given the day of 01-01-2019)
                               Data Members
                               String s                     :   to store the future date in DD-MM-YYYY format
                               String f                     :   to store the day  of 01-01-2019
                               Member Functions
                               Ddate()                      :   constructor to initialise data member to null
                               void accept()                :  to accept the values of s and f
                               void find_day()              :  to find and display the day of the future date
                 1       import java.util.*;

                 2       class Ddate

                 3       {
                 4       String s,f;
                 5       Ddate()

                 6       {
                 7       s=f="";

                 8       }
                 9       void accept()







                646646  Touchpad Computer Science-XII
   643   644   645   646   647   648   649   650   651   652   653