Monday, April 12, 2021

My Life In Brief



Phoenix Le is my nickname on FB: 
       https://www.facebook.com/ijkxyz.le

TSL (Thien-Si Le) is my acronym on my Blog:
       tslbloggerpage.blogspot.com/2016/04/about-tsl.html

Some info of my escape out of Vietnam in 1979 is posted on the FB link :
       https://www.facebook.com/BT0405
       (Note: BT 0405 is the registration number of the refugee boat that carried
                 424 boat people out of Vietnam in 6/1979)

     Started doing errand work at 7 years old, I was a top student at all Grade 8 classes, top 5 at High School, entered Naval Academy then joined the Navy due to mobilization in VietNam War in 1970.

     With 2 years of training (1-year learning theories at Naval Academy and another year of on-job-training on different navy ships), I graduated Number 7 in total 282 Midshipmen. After graduation as an Ensign then Lieutenant Junior Grade, I took an oath in the code of Honor, Duty and Country, and fought against the Communists all the way in South Vietnam and twice was assigned on USS Wiltsie DD716 from US 7th Fleet, and USS Hector AR 7 at Guam, and other navy ships such as PCE HQ07, PGM HQ615, MSC HQ115, YOG HQ473.

     With the collapse of Saigon, we lost the Vietnam War on 04/30/1975, and I became a prisoner/reformer doing all hard labor works in the jungle for 3.5 years. During this time, I was a team leader of a group of 30 highly skilled prisoners who repaired military tanks, water pumps, combustion engines, all kinds of vehicles, bulldozers, farming tractors, heavy motors, scavenger machine, heavy machinery, etc. for Communists who won the War.

     Escaped from the concentration camp in 12/1978, I, as a fugitive, spent 6 months rebuilding a 75 ft by 15 ft riverboat and became a captain-by-chance who used this boat to carry 424 refugees (boat people) out of South VN to East Malaysia in 6/1979. In a refugee camp at Pulau Papan, Malaysia, with about 900 refugees, I was elected as a refugee camp leader.   

     After 4 months in the refugee camp, I was sponsored by an 80-years old retired lawyer Ruth Codier and transferred to Lexington, MA in 11/1979. In Lexington and Boston, I worked as a machinist in Watertown, Vietnamese-English interpreter, and learned English 18 hours a day. I was invited to be a guest speaker about boat people’s problems at several forums at Harvard Kennedy School of Government, Cambridge Adult Education Center and USCC (US Catholic Conference) Church. I attended Boston University (BU) in 9/1980 with a scholarship and finished BS in Electrical Engineering. I was offered a full-time job of Test Engineer at a high-tech company Teradyne, Inc. in February 1984 before I graduated in May 1984. I worked consecutively for 30 years at Teradyne then Cambridge Technology, Inc. from various positions: Test Engineer (Engr), Test Development Engr, Factory Engr, System Engr, Applications Engr, Quality Assurance Engr, Software Engr, Senior Principle Engr, Technical Lead, Technical Consultant,… I have traveled to many US Air Force Bases, Navy bases to support Teradyne Systems, Spectrum 9100 on software and hardware for testing many equipment and instruments on US Naval Carriers, Air Force C-17 military airplanes, B2 Bombers, B1B Bombers, F35, etc.

     During working for Teradyne, Inc., I also studied and earned a Master of Science in Computer Science (CS) at BU with tuition paid by Teradyne in 1997. In 2013, I at 64 years old, came back to college and spent 16 – 20 hrs a day in 4 years to earn a Ph.D. in CS then did consultant work, book reviewer, lecturer and supported the family. Note that I also had Engineer-in-training License in MA and took many software courses (tuition paid by Teradyne) at BU, Northeastern U., and the U. of MASS.

     In Martial Arts, I might be the oldest student at Mu Han who has spent 8 years (while other students spent 15 years) in the dojo to obtain 1st, 2nd, 3rd, and 4th degrees in Black Belt in disciplines of TaeKwonDo, KungFu, HapKiDo, Yoga, and weapons (sword, staff). Spending 16 hours a week teaching and practicing martial arts, I am an official Assistant Instructor, Instructor then Martial Arts Master titles certified by Kukkiwon, Mu Han Martial Arts, MoonMooKwan. Currently, I pursue Bushido, Samurai, and Chivalry while my wife Tracy and 3 kids follow Catholicism. Every day, I spend 2.5 hours practicing Martial Arts based on 3 essential elements (Sharp Mind, Strong Body, and Special Techniques).  

     Because of the VN War, I focused only on fighting against the enemies, and I was not sure that I could survive. For that reason, I get married very late. My former sweetheart Collete, whom I met on the refugee boat during an escape of VN, was 12 years younger than I was. After 17 years, unfortunately, this marriage was broken perhaps because I studied and worked too much, e.g., 70 hours a week; and we had no kid. Then, I met my current wife Tracy in 2000. Tracy was 20 years younger when I was 51. Now, at 72 years old, I still work one way to another to support, nurse and guide 3 young kids (at 12, 16, and 19). I love my kids dearly. Therefore, I do not mind doing 95% of the housework, and pay 90% of family expenses!

     In the meantime, I take care of the family, continue practicing yoga, particularly martial arts, called Neo-Yoga, Open Martial Arts, and doing Open Consultant Work in Education as well as lecturing to transfer some valuable knowledge to younger generations !


Wednesday, April 15, 2020

Thứ Bảy, Ngày 15 Tháng Tư Năm 1972

https://www.youtube.com/embed/EbmmvXKfdXM

Kỷ Niệm 48 Năm [15/04/1972 - 15/04/2020]
Thứ Bảy, Ngày 15 Tháng Tư Năm 1972
Ngày Ra Truờng Sĩ Quan Hải Quân Nha Trang của Khóa 23 Đệ Nhị Bảo Bình



Đệ Nhị Bảo Bình




Tuesday, April 7, 2020

Master Program in Martial Arts



MASTER PROGRAM

A. Title of Master

     1. Philosophy and knowledge of the Mu Han Martial Arts
            Martial Arts origin comes from human structure in creation. Human structure consists of (a) 4 legs to 2 legs, (b) a flexor and an extensor, (c) a voluntary muscle and an involuntary muscle, (d) hormone. In Martial Arts development, an adaption of Martial Arts to a residential nature environment includes a region (i.e., weather, size of land, elevation), food source, transportation, and geographical position with enemy. The Skill to Art is the power source of main weapon in war from ancient time to present time through a stone age, bronze and metal period to gun powder today.      
            A variety of the Martial Arts is the rules in the artificial environment. The rules include (a) floor material and size such as the ring, mat, etc., (b) protector, i.e., protective gears, mouth guards, (c) permissible range of attack, and (d) belts and ranking. Martial Arts are classified into 4 categories:
·         Martial or military: Instant action/reaction, momentary knowledge. It is inefficient and nonsense.
·         Martial Technique: Constant teaching, continuous knowledge. It is efficient and making sense.
·         The Way of Martial Arts: How to pass technique from one generation to another generation. For example, instructor class, Taekwondo, Kung Fu, Karate, Judo, Kendo, etc.
·         Martial Arts: Through The Way of Martial Arts, martial technique becomes the Art. For instance, we are the Arts.
During learning and teaching Martial Arts, especially Tae Kwon Do (TKD), Mu Han Total Martial Arts requires all masters, instructors and students to focus on three principal aspects, i.e., (a) Jeong, (b) Ki, (c) Shin with Joong Yong. To be an ideal martial artist, Mu Han recommends that students, particularly masters, should keep in mind a good balance between these aspects in TKD.

     2. Forms    
Forms are techniques, patterns or poomsaes. In traditional martial arts, there are 18 techniques. Later, great grand masters/founders add 6 more techniques such as bow, arrows, horse riding. Therefore, modern martial arts have 24 techniques. Technique comprises (a) physical technique and (b) strategy (mental technique):
          a. Physical technique: To make a strategy successful, one or more basic motions are combined together. For example, a martial artist’s left hand block on an opponent’s punch is followed by his back turn for a right elbow on the opponent’s face/jaw, then the martial artist’s front turn to deliver a roundhouse kick to the opponent’s belly. A combination of basic motions intends to make an opponent confuse and unpredictable.
          b. Strategy is a mental technique which a martial artist can use to offense, defense, counter-attack, protect, disable effectively the opponents. A martial artist can use strategy on the motions at really quick momentum/inertia, actual action with great impact or strong delivery.
            For Master Level, a candidate requires to perform:
a. World Taekwondo: Tae Baek
b. International Moon Mu Kwan: Um Yang Soo II
c. Kung Fu: Mae Hwa Ran
d. Mae Hwa Kwon    

     3. Physical
            Physical or Shin is one of 3 principal aspects (Jeong (Mentality), Ki (Technique), Shin (Physical body)) in Martial Arts. Physical is body, physical conditions of the martial artists.
·         Mu Han Physical and Target
This aspect focuses on the requirements for testing, including 12 hand motion sets (6 offenses, 6 defenses), poomsaes, Mu Han kicks, and board breaking. All activities such as warm-up, sit-up, push-up, fast-paced movement, stretch, etc. that improves the body for better kicking and punching require a martial artist’s body strength. Martial artists need to be in top physical shape in order to perform their best.

1st Quarter
2nd Quarter
3rd Quarter
4th Quarter
Isolated
Flexible
Multi Join
Martial Arts Basics

     4. Sparring
            Sparring is essential training for martial artists because it teaches students how to use distance to control their own attacks and defenses. It teaches blocking and kicking techniques (actually trying to hit a target rather than just the air). It teaches control of one's own techniques. It is testing your marital art skills against another person in a controlled environment.
At Mu Han, sparring comprises full contact (Olympic style), light contact, no contact and step sparring.
            * World Taekwondo style
            * Wushu
            * Judo
            * Aikido (Step sparring)
            * Moon Mu Kwan (Step sparring)

     5. Self Defense:
            Self Defense is awareness. While Martial Arts is a study subject, Self Defense is a survival skill. Self Defense only concerns a martial artist’s safety. On the other hand, his/her opponent’s safety is not in concern. The knowledge of Self Defense is not only to physically attack from someone but also how to keep healthy mind and strong body.
Self Defense Technique is divided into 3 objects: Men, Women and Martial Arts joint locking principle.   
            * For Men: Awareness, Throat, Fist Swing and Tackle
            * For Women: Awareness, Holding from the front, Holding from the back, Ground defense, and Escaping ground.
            * Arts joint locking principle:
                        Outside in: Shoulder and Throat
                        Inside out: Throat and Wrist
                        High to Low: Head

      6. Teaching:
            Assistant Instructor (AI) Course: two-year program (4 semesters) for leadership students who support all activities carried out at each do jang during class as well as testing and special occasions or events. The AI is responsible of taking attendance using management software from Martialytics. After 2-years training, the assistant instructor will be graduated with a certified title Martial Arts Instructor at Mu Han.
            Instructor is responsible of following the “2-1 Color Belt Instruction” sheet in preparation of the class. This position is responsible of guiding and instructing the students’ progression in requirements implementing MU Han’s curriculum. The instructor must strive to maintain the quality of instruction of the class as per Mu Han’s quality standards learned during the 4-semester instructor course.. Give support to the Head Master, Director of Discipline and Masters as per their request.
            Communication Lead Instructor (CLI) manages communications between Mu Han and the students/parents, supports managerial activities at the dojang. CLI is responsible for reports requested by the Head Master, as well as maintenance of the student database Martialytics in that dojang. Give support to the Head Master, Director of Discipline and Masters as per their request. Keep track of trial students and report to the Head Master, Director of Discipline, Masters and/or Lead Instructor.
            Lead Instructor (LI) oversees the general management of the dojang and instruction of students. LI is responsible of all reports as well as maintenance of the student database Martialytics in the dojang. Oversee that the instructors and assistant instructors in the dojang uphold Mu Han’s values and code of respect at all times within the school grounds and surroundings. Give support to the Head Master, Director of Discipline, and Masters as per their request.   
            Masters have responsibilities and duties similar to Lead Instructor. In addition, the masters have more freedom to overlook and support all activities and events at Mu Han. They may provide vision and determine the growth of Mu Han under the guidance from the Head Master and Director of Discipline. Also, they should find their own path in Martial Arts through Mu Han by seeing and realizing boundary and build up standard or benchmark for subject based on the main purpose of contact, the style of Arts, the methods and the standard of contact power level. 

B. Certifications

     1. World Taekwondo Federation by Kukkiwon
            World Taekwondo Federation (WTF) is located in Seoul, Korea and established in 1973. WTF is the international organization governing the sport of Taekwondo and it is a member of the Association of Summer Olympic International Federation. The Kukkiwon conducts standardized Dan promotion tests and issues black belt certificates to Taekwondo practitioners through member nation associations of the WTF.  

     2. Moon Moo Kwan Taekwondo
            Moon Moo Kwan Taekwondo (MMK), also called Professional Taekwondo, is an organization established in 1966 to train Korean Army and Navy forces. International MMK. It was found by Master Young Park in Korea. The IMMK certification indicates the practitioners go a step further in their martial arts journey.

     3. Jing Fu Kung Fu
            Jing Fu Kung Fu focuses on “mastering others is strength; mastering yourself makes you fearless” Certifications of the Jing Fu Kung Fu point out that the practitioner masters his/her technique, mentality and physical body.

     4. Mu Han Total Martial Arts
            Mu Han Total Martial Arts is based on different Eastern culture striking techniques. “To be the best of the best……!” Students all come to Mu Han with different goals and expectation, but together we will travel the same path of discipline to achieve all the goals the students have set and most likely more. Mu Han conducts Black Belt promotion tests and issues Black Belt certifications to students through Mu Han Total Martial Arts System.

C. Subject to study
     1. World Taekwondo Federation style
            World Taekwondo Federation (WTF) is renowned for its involvement in international competitions, primarily Olympics developed by General Choi. WTF is quick, tactical, and more commercial in nature. WTF has the forms or poomsae and does not allow punch to the face though it’s a full-contact sport.

     2. Moon Moo Kwan
Moon Moo Kwan Taekwondo (MMK), also called Professional Taekwondo, is an organization established in 1966 to train Korean Army and Navy forces. International MMK helps TKD practitioners and schools to expand their current curriculum with modernized martial arts skill based on traditional movements developed by MMK founders, i.e., Master Young Park. MMK’s striking techniques have a very explosive impact, rendering this art to be used in battle rather than sports. Therefore it is only suitable for the Special Force, West Point, President body guards, and Police 707 Special Task Team in Korea.

    3. Sip Pal Ki   
            Sip Pal Ki is a Korea Martial Art first organized in 1759. It consists of a system of eighteen traditional military practices followed in Korea. These techniques are classified into three categories: thrust slice, and strike. They reflect the strong influence from Chinese Martial Arts and the tactical military situation of the 16th and 17th centuries, before firearms and modern military technology replaced bladed weapons as a primary-use in the Korean Army.

     4. Kung Fu
            Kung Fu was derived from traditional Chinese martial arts. It was developed in China after 1949 in effort to standardize the practice of traditional Chinese martial arts. The forms include basic movements such as stances, balances, jumps, sweeps and throws,
It bases on aggregate categories of traditional Chinese martial art style. It can be changed for competitions to highlight a practitioner’s strengths. Modern Kung Fu competitors are increasingly training in aerial techniques such as 540 and 720 or even 900 degree jumps and kicks to add more difficulty and style to their forms.

     5. Kum Do
            Kum Do is a modern Korean martial art derived from Japanese Kendo. Kum Do means the way of the sword or Korea martial arts based upon swordsmanship in 1927.
Kumdo practitioners generally favor a dynamic style of play, focusing on using fast, aggressive, and effective small motion strikes to create openings for attacks more in line with battlefield use.

D. Testing for 4th Dan

     1. Eligibility
            To be eligible for Sa Dan promotion test, a martial artist must satisfy 3 conditions:
            * Mu Han 3rd Dan: A martial artist must have Mu Han Sam Dan.
            * Four years in training and practice: Fully completed eight semesters 
            * Over 24-years-old

     2. Focus Training Period
            * Six months in training focuses on 3 principal aspects: Mind, Body, and Technique
            * Video recording each month

6-Month Focus Training
Aspects
1st
2nd
3rd
4th
5th
6th
Mind
Origin of Martial Arts
Basic Knowledge
History of Martial Arts
Conditions to live, culture and Martial Arts
Select subject of Essay
Writing Essay
Body
Isolated
Flexible
Multi Join
Multi Join
Flexible

Technique
Moon Moo Kwan
Moon Moo Kwan
Sip Pal Ki Kung Fu
Taekwondo
All


     3. Subject to Training
            All requirements

     4. Division of Intensity
            - Senior: Less than 39 years old
            - Mid senior: Less than 55 years old
            - Golden Senior: 55 years old or more

     5. Actual Schedule
            Note: Subject to be changed on every Testing

Training Schedule
Days
Dojang
Time
Monday
Taunton
6:40 PM – 7:30 PM
Tuesday
N. Attleboro
6:20 PM – 8:00 PM
Thursday
Franklin
6:20 PM – 8:00 PM
Meeting
Taunton
30 Minutes after every Taunton Color Belt Testing
Summer
Outdoor Training
2 nights and 3 days
(Date and location: To be determined)



MASTER PROGRAM

4th DAN FOCUS PRACTICE

A. Terms: 6 months

            Note: Subject to be changed every Testing.
            - February 2020 through August 2020
            - Pre-Testing schedule: To be declared
            - MUSA: Mu Han Black Belt Festival in November 2020
                            Date : To Be Declared

B. Subject
            1. Physical condition
                  - Isolation: Striking fast with hands or legs
                                     Single motion with Ki Bon (Basic)
                                     Ki Bon Jak (Basic motions)
                  - Mu Han Multi joint:
                                     Connecting motions in Hap or Soo
                  - Mobility
           
2. Technique
                
                 - World Taekwondo Federation
                 - Sip Pal Ki
                 - Kung Fu
                 - Moon Moo Kwan
                 - Mu Han Weapons: Sword, staff, etc.

                 Technique comprises:
* Physical technique:
In order to make successful strategy, put one or more basic motions together
* Strategy or Mental Technique
                             Offense, Defense, Counter Attack, Protect, Disabled and so co

            3. Philosophy, Knowledge, and History

            4. Seminar

C. Schedule
            Note: Subject to be changed in every Testing
                 - Weekly until August
Weekly Schedule
Class
Lead
1/4
2/4
3/4
4/4
1st
Masters
Physical
Physical
Basic Motion
Requirement
2nd
Masters
Physical
Basic Motion
Basic Motion
Requirement
3rd
Masters
Physical
Basic Motion
Requirement
Requirement
4th
Masters
Requirement

                 - Monthly
Monthly Schedule
February
March
April
May
June
Physical
Physical
History
Philosophy
Theory
TKD
Kung Fu
Moon Moo Kwan
All
All

                 - Seminar

D. Report and Evaluation
            - Open discussion at every end of the month
            - Check with all physical report (To be determined and given)
               And encouraging improvements each other
            - Each month allow to 1 sick day. However, it must to be make-up within the
   month
- Special Attendance Card will be filled each class

E. Miscellaneous
- Mu Han preserves the right to bring in outsource instructors or trainers from    
  other Martial Arts schools
            - Any other practice or participation must report to Head Master
            - Mu Han Head Master and Director of Discipline’s decision may override the
  rules and regulations if necessary.

F. Cost or Tuition
     1. Application Fee: 
Note: Due at 60 days before MUSA Festival
            - World Taekwondo Kukkiwon 4th Dan:                  $150
            - International Moon Moo Kwan 4th Dan:               $150
            - Mu Han Total Martial Arts Master Certification:  $175

     2. Focus Training Fee: 
Note: Pay between 6-months Training          
            - 24 Weeks:   $2,880

     3. 4th Dan Do Bok and Belt
            - Do Bok (Uniform) :   $165
            - Belt :                            $60

     4. Pre-Testing Trip
            - To Be Announced

     5. After-MUSA Festival Dinner
            - To Be Announced 




A View on CoViD-19 Death


My View on CoViD-19 Death
Written by April 04, 2020

Coronavirus 
(Source: US DoD - March 2020)

     Top medical doctors and scientists in US who based on the past 3-month data of deaths, drew the CoViD-19 Model curve at its apex of 100,000 to 240,000 deaths. The data might be accurate - assume that the number of death in China/WuHan and world data collection are correct - during the last few months. Currently, the number of deaths (NoD) is high.

     However, all healthcare workers are now aware and the whole medical world pay a lot of attention to the illness. Doctors, scientists and researchers are racing to find the cure (medication and vaccine) and also have much more experience in treatment. Notice that medical data becomes much more dynamic along with the ultra-fast learning curve of the doctors, nurses, EMT, etc. In order to obtain the proper model for accurate CoViD-19 curve, the scientists should use medical data in motion or data in transit. This data in use is a dynamic data processed by analyzing it on the fly without storing it in real time. The high-tech software tools for data analytics or statistics are Hadoop, R Project, Tableau, SPSS, QSR NVivo, or ATLAS.

     Therefore, rate of deaths should be lower. Consequently, NoD is much lower than the predicted number of death announced by the President last week. My prediction is that NoD should be less than 100,000 – it could be around 50,000 in US at this time. But the number of deaths (NoD=50,000 in US) is still unacceptable by the medicine community.

God Bless All of Us !

Wednesday, May 15, 2019

Java Programming: Time Conversion

/* The complex Java code can be used to convert time (Years, Months, Dates, Hours, Minutes, Seconds).
It will display appropriate time (years, months, dates, etc) when time is increased or decreased. For example, it will show leap year, months (28, 29, 30, or 31 days).
*/

package timeside;
import java.util.Scanner;

class MyTime
{ 
    Scanner input = new Scanner(System.in);
 
    int year, month, day, hour, minute, second;
    private String Month;
    int time[][] = new int[3][6];
 
    MyTime(int i)
    {
        year  = i;
        month = i;
        day   = i;
        hour  = i;
        minute= i;
        second= i;
    }
 
    String convertMonth(int mont)
    {
        switch (mont)
        {
            case 1:
                Month = "January";
                break;
            case 2:
                Month = "February";
                break;
            case 3:
                Month = "March";
                break;
            case 4:
                Month = "April";
                break;
            case 5:
                Month = "May";
                break;
            case 6:
                Month = "June";
                break;
            case 7:
                Month = "July";
                break;
            case 8:
                Month = "August";
                break;
            case 9:
                Month = "September";
                break;
            case 10:
                Month = "October";
                break;
            case 11:
                Month = "November";
                break;
            case 12:
                Month = "December";
                break;
            default:
                System.out.println("Invalid month !");
        }
        return Month;
    }
 
    boolean chkLeapYr(int year)
    {
        if (year%4 != 0)          // common year
            return false;
        else if (year%100 != 0)   // leap year
            return true; 
        else if (year%400 != 0)   // common year
            return false;
        else
            return true;          // leap year
    }
 
    void enterDate()
    {
        int i;
        for (i=0; i<3; i++)
        {
            switch (i)
            {
                case 0:   
                    System.out.print("Enter Year: ");
                    time[0][0] = input.nextInt();
                    if (time[0][0]<1 | time[0][0]>9999)
                    {
                        System.out.print("Invalid year. It should be between 1 and 9999. Reenter years: ");
                        time[0][0] = input.nextInt();
                    }
                    break;
                case 1:   
                    System.out.print("Enter Month: ");
                    time[0][1] = input.nextInt();
                    if (time[0][1]<1 | time[0][1]>12)
                    {
                         System.out.print("Invalid month. It should be between 1 and 12. Reenter months: ");
                         time[0][1] = input.nextInt();
                    }
                    break;
                case 2:   
                    System.out.print("Enter Day: ");
                    time[0][2] = input.nextInt();
                    switch (time[0][1])     // month
                    {
                        case 1:
                        case 3:
                        case 5:
                        case 7:
                        case 8:
                        case 10:
                        case 12:
                            if (time[0][2]<1 | time[0][2]>31)
                            {
                                System.out.print("Invalid day. It should be between 1 and 31. Reenter days: ");
                                time[0][2] = input.nextInt();
                            }
                            break;
                        case 2:
                            if (chkLeapYr(time[0][0]) == true)  // leap year
                            {
                                if (time[0][2]<1 | time[0][2]>29)
                                {
                                    System.out.print("Invalid day. It should be between 1 and 29. Reenter days: ");
                                    time[0][2] = input.nextInt();
                                }
                            }
                            if (chkLeapYr(time[0][0]) == false)  // common year
                            {
                                if (time[0][2]<0 | time[0][2]>28)
                                {
                                    System.out.print("Invalid day. It should be between 1 and 28. Reenter days: ");
                                    time[0][2] = input.nextInt();
                                }
                            }
                            break;
                        case 4:
                        case 6:
                        case 9:
                        case 11:
                            if (time[0][2]<1 | time[0][2]>30)
                            {
                                System.out.print("Invalid day. It should be between 1 and 30. Reenter days: ");
                                time[0][2] = input.nextInt();
                            }
                            break;
                    }
                    break;
                default: 
                    System.out.println("Invalid date");
            } 
        }
     
        for (i=0; i<3; i++)  // copy time[0][0,1,2] to time[1][0,1,2] and time[2][0,1,2]
        {
            time[1][i] = time[0][i];
            time[2][i] = time[0][i];
        }
     
    }
         
    void enterTime()
    {
        int i, temp;
     
        for (i=0; i<3; i++)
        {
            switch (i)
            {
                case 0: 
                    System.out.print("Enter Hours: ");
                    time[0][3] = input.nextInt();
                    if (time[0][3]<0 | time[0][3]>23)
                    {
                        System.out.print("Invalid hours. It should be between 0 and 23. Reenter hours: ");
                        time[0][3] = input.nextInt();
                    }
                    break;
                case 1:   
                    System.out.print("Enter Minutes: ");
                    time[0][4] = input.nextInt();
                    if (time[0][4]<0 | time[0][4]>59)
                    {
                        System.out.print("Invalid minutes. It should be between 0 and 59. Reenter minutes: ");
                        time[0][4] = input.nextInt();
                    }
                    break;
                case 2:
                    System.out.print("Enter Seconds: ");
                    time[0][5] = input.nextInt();
                    if (time[0][5]<0 | time[0][5]>59)
                    {
                         System.out.print("Invalid seconds. It should be between 0 and 59. Reenter seconds: ");
                         time[0][5] = input.nextInt();
                    }
                    break;
                default: 
                    System.out.println("Invalid time");
            }
        }
     
        for (i=3; i<6; i++)  // copy time[0][3,4,5] to time[1][3,4,5] and time[2][3,4,5]
        {
            time[1][i] = time[0][i];
            time[2][i] = time[0][i];
        }
    }
     
    void displayStdTime(int month, int day, int year, int hour, int minute, int second)
    {
        int hr=0;
        String mon;
 
        //System.out.println(month+"/"+day+"/"+year+"  "+hour+":"+minute+":"+second);
        //System.out.print("  Standard form: ");
        mon = convertMonth(month);
        switch (hour)
        {
            case 12:
                hr = hour;
                break;
            case 13:
                hr = hour-12;
                break;
            case 14:
                hr = hour-12;
                break;
            case 15:     
                hr = hour-12;
                break;
            case 16:
                hr = hour-12;
                break;
            case 17:
                hr = hour-12;
                break;
            case 18:
                hr = hour-12;
                break;
            case 19:
                hr = hour-12;
                break;
            case 20:     
                hr = hour-12;
                break;
            case 21:
                hr = hour-12;
                break;
            case 22:
                hr = hour-12;
                break;
            case 23:
                hr = hour-12;
                break;             
        }
     
        System.out.print(mon+" ");
        if (day<=9)
            System.out.print("0"+day+",");
        else System.out.print(day+",");
     
        if (year>999 & year<=9999)
            System.out.print(" "+year);
        else if (year>99 & year<=999)
            System.out.print(" "+"0"+year);
        else if (year>9 & year<=99)
            System.out.print(" "+"00"+year);
        else if (year>=1 & year<=9)
            System.out.print(" "+"000"+year);
        else System.out.print(" "+year);
     
        if (hour<12)
        {
           if (hour<=9)
           {
                if (hour==0)
                    System.out.print("  "+"12");
                else System.out.print("  "+"0"+hour);
           }
            else System.out.print("  "+hour);
        }
        else
        {
            hr = hour-12;
            if (hr<=9)
            {
                if (hour==0)
                    System.out.print("  "+"12");
                else System.out.print("  "+"0"+hr);
                 
            } 
            else System.out.print("  "+hr);
        } 
     
        if (minute<=9)
            System.out.print(":"+"0"+minute);
        else System.out.print(":"+minute);
     
        if (second<=9)
            System.out.print(":"+"0"+second);
        else System.out.print(":"+second);
     
        if (hour<12)
            System.out.print(" AM");
        else System.out.print(" PM");
        System.out.println("");
    }

    void displayMilTime(int month, int day, int year, int hour, int minute, int second)
    { 
        if (month<=9)
            System.out.print("0"+month);
        else System.out.print(month);
        if (day<=9)
            System.out.print("/"+"0"+day);
        else System.out.print("/"+day);
     
        if (year>999 & year<=9999)
            System.out.print("/"+year);
        else if (year>99 & year<=999)
            System.out.print("/"+"0"+year);
        else if (year>9 & year<=99)
            System.out.print("/"+"00"+year);
        else if (year>=1 & year<=9)
            System.out.print("/"+"000"+year);
        else System.out.print("/"+year);

        if (hour<=9)
            System.out.print("  "+"0"+hour);
        else System.out.print("  "+hour);
        if (minute<=9)
            System.out.print(":"+"0"+minute);
        else System.out.print(":"+minute);
        if (second<=9)
            System.out.print(":"+"0"+second);
        else System.out.print(":"+second);
        System.out.println(""); 
    }
//////////////////////////////////////////////////////////////////////////////// 
    void increaseTime(String str)
    {
        int temp;

        switch (str)
        {
///
            case "1s":   // seconds
                //System.out.print("  Increment 1 second.");
                temp = 1;   // By default 1s
             
                time[1][5] = time[1][5]+temp;
                if (time[1][5]>59)      // number of seconds > 59
                { 
                    time[1][5] = time[1][5]-60;
                    time[1][4] = ++time[1][4];      // increment number of minutes by 1 mn
                }
                if (time[1][4]>59)
                {
                    time[1][4] = time[1][4]-60;
                    time[1][3] = ++time[1][3];  // increment number of hrs by 1 hr
                }
             
                if (time[1][3]>23)
                {
                    time[1][3] = time[1][3]-24;
                    switch (time[1][1])
                    {
                        case 1:  //31 days
                        case 3:
                        case 5:
                        case 7:
                        case 8:
                        case 10:
                        case 12:
                            time[1][2] = ++time[1][2];
                            if (time[1][2]>31)
                            {
                                time[1][2] = time[1][2]-31;
                                time[1][1] = ++time[1][1];
                            }
                            break; 
                        case 4: //30 days
                        case 6:
                        case 9:
                        case 11:
                            time[1][2] = ++time[1][2];
                            if (time[1][2]>30)
                            {
                                time[1][2] = time[1][2]-30;
                                time[1][1] = ++time[1][1];
                            }
                            break;                           
                        case 2:     // 28 or 29
                            time[1][2] = ++time[1][2];
                            if (chkLeapYr(time[1][0]))      // leap year
                            {
                                if (time[1][2]>29)
                                {                         
                                    time[1][2] = time[1][2]-29;  // days
                                    time[1][1] = ++time[1][1];   // month+1
                                }
                            }
                            else                             // common year
                                if (time[1][2]>28)
                                {                         
                                    time[1][2] = time[1][2]-28; // days
                                    time[1][1] = ++time[1][1];  // month+1
                                }
                            break;                         
                    }
                }
                switch(time[1][1])  // month
                {
                    case 1:
                    case 3:
                    case 5:
                    case 7:
                    case 8:
                    case 10:
                    case 12:
                        if (time[1][2]>31)
                        {
                            time[1][2] = time[1][2]-31; // days
                            time[1][1] = ++time[1][1];  // month+1
                        }
                        break;
                    case 4:
                    case 6:
                    case 9:
                    case 11:
                        if (time[1][2]>30)
                        {
                            time[1][2] = time[1][2]-30; // days
                            time[1][1] = ++time[1][1];  // month+1
                        } 
                        break;
                    case 2:
                        if (chkLeapYr(time[1][0]))      // leap year
                        {
                            if (time[1][2]>29)
                            {                         
                                time[1][2] = time[1][2]-29;  // days
                                time[1][1] = ++time[1][1];   // month+1
                            }
                        }
                        else                             // common year
                            if (time[1][2]>28)
                            {                         
                                time[1][2] = time[1][2]-28; // days
                                time[1][1] = ++time[1][1];  // month+1
                            }
                        break;
                }
                if (time[1][1]>12)  // months
                {
                    time[1][1] = time[1][1]-12; // months
                    time[1][0] = ++time[1][0];   
                }
                if (time[1][0]>9999)
                    System.out.println("Invalid year !");
                break;
///         
            case "s":   // seconds
                System.out.print("  Increase seconds by ");
                temp = input.nextInt();
                if (temp<0)
                {
                    System.out.print("Invalid seconds. It should be more than 0. Reenter seconds: ");
                    temp = input.nextInt();
                    time[1][5] = time[1][5]+temp;
                } else time[1][5] = time[1][5]+temp;
                if (time[1][5]>59)      // number of seconds > 59
                { 
                    time[1][4] = time[1][4]+time[1][5]/60;  // increment number of minutes by 1 mn
                    time[1][5] = time[1][5]%60;     // Remainder = seconds
                }
                if (time[1][4]>59)
                {
                    time[1][3] = time[1][3]+time[1][4]/60;  // increase hours
                    time[1][4] = time[1][4]%60;
                } 
                if (time[1][3]>23)
                {
                    time[1][2] = time[1][2]+time[1][3]/24;  // increase days
                    time[1][3] = time[1][3]%24;
                }
                switch(time[1][1])  // month
                {
                    case 1:
                    case 3:
                    case 5:
                    case 7:
                    case 8:
                    case 10:
                    case 12:
                        if (time[1][2]>31)
                        {
                            time[1][1] = time[1][1]+time[1][2]/31;  // icrease months
                            time[1][2] = time[1][2]%31; // days
                        }
                        break;
                    case 4:
                    case 6:
                    case 9:
                    case 11:
                        if (time[1][2]>30)
                        {
                            time[1][1] = time[1][1]+time[1][2]/30;  // increase months
                            time[1][2] = time[1][2]%30; // days
                        } 
                        break;
                    case 2:
                        if (chkLeapYr(time[1][0]))      // leap year
                        {
                            if (time[1][2]>29)
                            { 
                                time[1][1] = time[1][1]+time[1][2]/29;   // increase months
                                time[1][2] = time[1][2]%29;  // days
                            }
                        }
                        else                             // common year
                            if (time[1][2]>28)
                            { 
                                time[1][1] = time[1][1]+time[1][2]/28;  // increase months
                                time[1][2] = time[1][2]%28; // days
                            }
                        break;
                }
                if (time[1][1]>12)  // months
                {
                    time[1][0] = time[1][0]+time[1][1]/12;
                    time[1][1] = time[1][1]%12; // months 
                }
                if (time[1][0]>9999)
                    System.out.println("Invalid year !");
                break;
////////             
            case "m":   // minutes
                System.out.print("  Increase minutes by ");
                temp = input.nextInt();
                if (temp<0)
                {
                    System.out.print("Invalid minutes. It should be more than 0. Reenter minutes: ");
                    temp = input.nextInt();
                    time[1][4] = time[1][4]+temp;
                } else time[1][4] = time[1][4]+temp;
                if (time[1][4]>59)
                {
                    time[1][3] = time[1][3]+time[1][4]/60;  // increase hours
                    time[1][4] = time[1][4]%60; 
                } 
                if (time[1][3]>23)
                {
                    time[1][2] = time[1][2]+time[1][3]/24;  // increase days
                    time[1][3] = time[1][3]%24;
                }
                switch(time[1][1])  // month
                {
                    case 1:
                    case 3:
                    case 5:
                    case 7:
                    case 8:
                    case 10:
                    case 12:
                        if (time[1][2]>31)
                        {
                            time[1][1] = time[1][1]+time[1][2]/31;   // increase months
                            time[1][2] = time[1][2]%31;  // days 
                        }
                        break;
                    case 4:
                    case 6:
                    case 9:
                    case 11:
                        if (time[1][2]>30)
                        {
                            time[1][1] = time[1][1]+time[1][2]/30;   // icrease months
                            time[1][2] = time[1][2]%30;  // days
                        } 
                        break;
                    case 2:
                        if (chkLeapYr(time[1][0]))      // leap year
                        {
                            if (time[1][2]>29)
                            { 
                                time[1][1] = time[1][1]+time[1][2]/29;  // increase months
                                time[1][2] = time[1][2]%29; // days
                            }
                        }
                        else                            // common year
                            if (time[1][2]>28)
                            { 
                                time[1][1] = time[1][1]+time[1][2]/28;  // increase months
                                time[1][2] = time[1][2]%28; // days
                            }
                        break;
                }
                if (time[1][1]>12)  // months
                {
                    time[1][0] = time[1][0]+time[1][1]/12;
                    time[1][1] = time[1][1]%12; // days
                }
                if (time[1][0]>9999)
                    System.out.println("Invalid year !");
                break;
///             
            case "h":   // hours
                System.out.print("  Increase hours by ");
                temp = input.nextInt();
                if (temp<0)
                {
                    System.out.print("Invalid hours. It should be more than 0. Reenter hours: ");
                    temp = input.nextInt();
                    time[1][3] = time[1][3]+temp;
                } else time[1][3] = time[1][3]+temp;             
                if (time[1][3]>23)
                {
                    time[1][2] = time[1][2]+time[1][3]/24;  // increase days
                    time[1][3] = time[1][3]%24;
                }
                switch(time[1][1])  // month
                {
                    case 1:
                    case 3:
                    case 5:
                    case 7:
                    case 8:
                    case 10:
                    case 12:
                        if (time[1][2]>31)
                        {
                            time[1][1] = time[1][1]+time[1][2]/31;   // increase months
                            time[1][2] = time[1][2]%31;  // days
                        }
                        break;
                    case 4:
                    case 6:
                    case 9:
                    case 11:
                        if (time[1][2]>30)
                        {
                            time[1][1] = time[1][1]+time[1][2]/30;   // increase months
                            time[1][2] = time[1][2]%30;  // days
                        } 
                        break;
                    case 2:
                        if (chkLeapYr(time[1][0]))      // leap year
                        { 
                            if (time[1][2]>29)
                            { 
                                time[1][1] = time[1][1]+time[1][2]/29;  // increase months
                                time[1][2] = time[1][2]%29; // days
                            } 
                        }
                        else                            // common year
                            if (time[1][2]>28)
                            { 
                                time[1][1] = time[1][1]+time[1][2]/28;  // increase months
                                time[1][2] = time[1][2]%28; // days
                            } 
                        break;
                }
                if (time[1][1]>12)  // months
                {
                    time[1][0] = time[1][0]+time[1][1]/12;
                    time[1][1] = time[1][1]%12; // months
                }
                if (time[1][0]>9999)
                    System.out.println("Invalid year !");
                break;
///                 
            case "D":
                System.out.print("  Increase days by ");
                temp = input.nextInt();
                if (temp<0)
                {
                    System.out.print("Invalid days. It should be more than 0. Reenter days: ");
                    temp = input.nextInt();
                    time[1][2] = time[1][2]+temp;
                } else time[1][2] = time[1][2]+temp;
                switch(time[1][1])  // month
                {
                    case 1:
                    case 3:
                    case 5:
                    case 7:
                    case 8:
                    case 10:
                    case 12:
                        if (time[1][2]>31)
                        {
                            time[1][1] = time[1][1]+time[1][2]/31;   // increase months
                            time[1][2] = time[1][2]%31;  // days
                        }
                        break;
                    case 4:
                    case 6:
                    case 9:
                    case 11:
                        if (time[1][2]>30)
                        {
                            time[1][1] = time[1][1]+time[1][2]/31;   // increase months
                            time[1][2] = time[1][2]%30;  // days
                        }
                        break;
                    case 2:
                        if (chkLeapYr(time[1][0]))      // leap year
                        {
                            if (time[1][2]>29)
                            { 
                                time[1][1] = time[1][1]+time[1][2]/29;   // increase months
                                time[1][2] = time[1][2]%29;  // days
                            }
                        }     
                        else                            // common year
                            if (time[1][2]>28)
                            {                         
                                time[1][1] = time[1][1]+time[1][2]/28;  // increase months
                                time[1][2] = time[1][2]%28; // days
                            } 
                        break;
                }
                if (time[1][1]>12)  // months
                {
                    time[1][0] = time[1][0]+time[1][1]/12;
                    time[1][1] = time[1][1]%12; // months   
                }
                if (time[1][0]>9999)
                    System.out.println("Invalid year !");
                break;
///             
            case "M":   // Months
                System.out.print("  Increase months by ");
                temp = input.nextInt();
                if (temp<0)
                {
                    System.out.print("Invalid month. It should be more than 0. Reenter months: ");
                    temp = input.nextInt();
                    time[1][1] = time[1][1]+temp;
                } else time[1][1] = time[1][1]+temp;
                if (time[1][1]>12)  // months
                {
                    time[1][0] = time[1][0]+time[1][1]/12;
                    time[1][1] = time[1][1]%12; // days
                }
                if (time[1][0]>9999)
                    System.out.println("Invalid year !");
                break;
////////             
            case "Y":   // Years
                System.out.print("  Increase years by ");
                temp = input.nextInt();
                if (temp<1 | temp>9999)
                {
                    System.out.println("Invalid year. It should be between 1 and 9999. Reenter years: ");
                    temp = input.nextInt();
                    time[1][0] = time[1][0]+temp;
                } else time[1][0] = time[1][0]+temp;
                if (time[1][0]>9999)
                    System.out.println("Invalid year !");
                break;
            default: System.out.println("Invalid date or time!");
        }
    }
////////////////////////////////////////////////////////////////////////////////
    void decreaseTime(String str)
    {
        int temp;

        switch (str)
        {
            case "1s":   // seconds
                //System.out.print("  Decrement 1 second.");
                temp = 1;   // By default 1s
                time[2][5] = time[2][5]-temp;     // temp>0
                if (time[2][5]<0)   
                { 
                    time[2][5] = 60+time[2][5];
                    time[2][4] = --time[2][4];   // decrement minutes by 1 mn
                }
                if (time[2][4]<0)
                {
                    time[2][4] = 60+time[2][4];
                    time[2][3] = --time[2][3];  // decrement hrs by 1 hr
                } 
                if (time[2][3]<0)
                {
                    time[2][3] = 24+time[2][3];
                    time[2][2] = --time[2][2];  // decrement days by 1 day
                }
     
                switch(time[2][1])  // month
                {
                    case 1:     // 31 days per month
                    case 3:
                    case 5:
                    case 7:
                    case 8:
                    case 10:
                    case 12:
                        if (time[2][2]==0)
                        {
                            switch(time[2][1])
                            {
                                case 1:
                                case 8:
                                    time[2][2] = 31+time[2][2];  // days
                                    if (time[2][1]==1)
                                    {                               
                                        time[2][1]=12;
                                        time[2][0]=--time[2][0];
                                    }                               
                                    else time[2][1] = --time[2][1];   // months-1
                                    break;
                                case 3:
                                    if (chkLeapYr(time[2][0]))      // leap year
                                    {
                                        time[2][2] = 29+time[2][2];  // days
                                        time[2][1] = --time[2][1];   // months-1                                     
                                    }
                                    else                             // not leap year = common year
                                    {
                                        time[2][2] = 28+time[2][2];  // days
                                        time[2][1] = --time[2][1];   // months-1                                 
                                    }
                                    break;
                                case 5:
                                case 7:
                                case 10:
                                case 12:
                                    time[2][2] = 30+time[2][2];  // days
                                    time[2][1] = --time[2][1];   // months-1
                                    break;
                            }
                        } 
                        if (time[2][2]<0)
                        {
                            time[2][2] = 31+time[2][2];  // days
                            time[2][1] = --time[2][1];   // months-1
                        }
                        break;
                    case 4:
                    case 6:
                    case 9:
                    case 11:
                        if (time[2][2]==0)
                        {
                            time[2][2] = 31+time[2][2];  // days
                            time[2][1] = --time[2][1];   // months-1
                        }
                        if (time[2][2]<0)
                        {
                            time[2][2] = 30+time[2][2]; // days
                            time[2][1] = --time[2][1];  // month+1
                        }
                        break;
                    case 2:
                        if (chkLeapYr(time[2][0]))      // leap year
                        {
                            if (time[2][2]==0)
                            {
                                time[2][2] = 31+time[2][2];  // days
                                time[2][1] = --time[2][1];   // months-1
                            }
                            if (time[2][2]<0)
                            {                         
                                time[2][2] = 29+time[2][2];  // days
                                time[2][1] = --time[2][1];   // months-1
                            }
                        }
                        else                            // common year
                        {
                            if (time[2][2]==0)
                            {
                                time[2][2] = 31+time[2][2];  // days
                                time[2][1] = --time[2][1];   // months-1
                            }
                            if (time[2][2]<0)
                            {                         
                                time[2][2] = 28+time[2][2];  // days
                                time[2][1] = --time[2][1]; // months-1
                            }
                        }
                        break;
                }
                if (time[2][1]<0)  // months
                {
                    time[2][1] = 12+time[2][1];  // months
                    time[2][0] = --time[2][0];   // years-1 
                }
                break;
         
            case "s":   // seconds
                System.out.print("  Decrease seconds by ");
                temp = input.nextInt();
                if (temp<0)
                {
                    System.out.print("Invalid seconds. It should be more than 0. Reenter seconds: ");
                    temp = input.nextInt();
                    time[2][5] = time[2][5]-temp;
                } else time[2][5] = time[2][5]-temp;     // temp>0
                if (time[2][5]<0)   
                { 
                    time[2][4] = time[2][4]-(Math.abs(time[2][5])/60+1);   // decrease mn
                    time[2][5] = time[2][5]+(Math.abs(time[2][5])/60+1)*60;
                }
                if (time[2][4]<0)
                {
                    time[2][3] = time[2][3]-(Math.abs(time[2][4])/60+1);  // decrease hr
                    time[2][4] = time[2][4]+(Math.abs(time[2][4])/60+1)*60;
                } 
                if (time[2][3]<0)
                {
                    time[2][2] = time[2][2]-(Math.abs(time[2][3])/24+1);  // decrease days
                    time[2][3] = time[2][3]+(Math.abs(time[2][3])/24+1)*24;
                }
                switch(time[2][1])  // month
                {
                    case 1:
                    case 3:
                    case 5:
                    case 7:
                    case 8:
                    case 10:
                    case 12:
                        if (time[2][2]==0)
                        {
                            switch(time[2][1])
                            {
                                case 1:
                                case 8:
                                    time[2][2] = 31+time[2][2];  // days
                                    time[2][1] = --time[2][1];   // months-1
                                    break;
                                case 3:
                                    if (chkLeapYr(time[2][0]))      // leap year
                                    {
                                        time[2][2] = 29+time[2][2];  // days
                                        time[2][1] = --time[2][1];   // months-1                                     
                                    }
                                    else                             // not leap year = common year
                                    {
                                        time[2][2] = 28+time[2][2];  // days
                                        time[2][1] = --time[2][1];   // months-1                                 
                                    }
                                    break;
                                case 5:
                                case 7:
                                case 10:
                                case 12:
                                    time[2][2] = 30+time[2][2];  // days
                                    time[2][1] = --time[2][1];   // months-1
                                    break;
                            }
                        }                       
                        if (time[2][2]<0)
                        {
                            time[2][1] = time[2][1]-(Math.abs(time[2][2])/31+1);   // months
                            time[2][2] = time[2][2]+(Math.abs(time[2][2])/31+1)*31;  // days
                        }
                        break;
                    case 4:
                    case 6:
                    case 9:
                    case 11:
                        if (time[2][2]==0)
                        {
                            time[2][2] = 31+time[2][2];  // days
                            time[2][1] = --time[2][1];   // months-1
                        }
                        if (time[2][2]<0)
                        {
                            time[2][1] = time[2][1]-(Math.abs(time[2][2])/30+1);  // months
                            time[2][2] = time[2][2]+(Math.abs(time[2][2])/30+1)*30; // days
                        }
                        break;
                    case 2:
                        if (chkLeapYr(time[2][0]))      // leap year
                        { 
                            if (time[2][2]==0)
                            {
                                time[2][2] = 31+time[2][2];  // days
                                time[2][1] = --time[2][1];   // months-1
                            }
                            if (time[2][2]<0)
                            { 
                                time[2][1] = time[2][1]-(Math.abs(time[2][2])/29+1);   // months
                                time[2][2] = time[2][2]+(Math.abs(time[2][2])/29+1)*29;  // days
                            }
                        }
                        else                            // common year
                        {
                            if (time[2][2]==0)
                            {
                                time[2][2] = 31+time[2][2];  // days
                                time[2][1] = --time[2][1];   // months-1
                            }
                            if (time[2][2]<0)
                            { 
                                time[2][1] = time[2][1]-(Math.abs(time[2][2])/28+1); // months
                                time[2][2] = time[2][2]+(Math.abs(time[2][2])/28+1)*28;  // days
                            }
                        }
                        break;
                }
                if (time[2][1]<0)  // months
                {
                    time[2][0] = time[2][0]-(Math.abs(time[2][1])/12+1);
                    time[2][1] = time[2][1]+(Math.abs(time[2][1])/12+1)*12;
                }
                break;
             
            case "m":   // minutes
                System.out.print("  Decrease minutes by ");
                temp = input.nextInt();
                if (temp<0)
                {
                    System.out.print("Invalid minutes. It should be more than 0. Reenter minutes: ");
                    temp = input.nextInt();
                    time[2][4] = time[2][4]-temp;
                } else time[2][4] = time[2][4]-temp;
                if (time[2][4]<0)
                {
                    time[2][3] = time[2][3]-(Math.abs(time[2][4])/60+1);  // decrease hrs
                    time[2][4] = time[2][4]+(Math.abs(time[2][4])/60+1)*60;   
                }
                if (time[2][3]<0)
                {
                    time[2][2] = time[2][2]-(Math.abs(time[2][3])/24+1);  // decrease days
                    time[2][3] = time[2][3]+(Math.abs(time[2][3])/24+1)*24;
                }
                switch(time[2][1])  // month
                {
                    case 1:
                    case 3:
                    case 5:
                    case 7:
                    case 8:
                    case 10:
                    case 12:
                        if (time[2][2]==0)
                        {
                            switch(time[2][1])
                            {
                                case 1:
                                case 8:
                                    time[2][2] = 31+time[2][2];  // days
                                    if (time[2][1]==1)
                                    {                               
                                        time[2][1]=12;
                                        time[2][0]=--time[2][0];
                                    }
                                    else time[2][1] = --time[2][1];   // months-1
                                    break;
                                case 3:
                                    if (chkLeapYr(time[2][0]))      // leap year
                                    {
                                        time[2][2] = 29+time[2][2];  // days
                                        time[2][1] = --time[2][1];   // months-1                                     
                                    }
                                    else                             // not leap year = common year
                                    {
                                        time[2][2] = 28+time[2][2];  // days
                                        time[2][1] = --time[2][1];   // months-1                                 
                                    }
                                    break;
                                case 5:
                                case 7:
                                case 10:
                                case 12:
                                    time[2][2] = 30+time[2][2];  // days
                                    time[2][1] = --time[2][1];   // months-1
                                    break;
                            }
                        }                     
                        if (time[2][2]<0)
                        {
                            time[2][1] = time[2][1]-(Math.abs(time[2][2])/31+1);   // months
                            time[2][2] = time[2][2]+(Math.abs(time[2][2])/31+1)*31;  // days
                        }
                        break;
                    case 4:
                    case 6:
                    case 9:
                    case 11:
                        if (time[2][2]==0)
                        {
                            time[2][2] = 31+time[2][2];  // days
                            time[2][1] = --time[2][1];   // months-1
                        }                     
                        if (time[2][2]<0)
                        {
                            time[2][1] = time[2][1]-(Math.abs(time[2][2])/30+1);  // months
                            time[2][2] = time[2][2]+(Math.abs(time[2][2])/30+1)*30; // days
                        }   
                        break;
                    case 2:
                        if (chkLeapYr(time[2][0]))      // leap year
                        {
                            if (time[2][2]==0)
                            {
                                time[2][2] = 31+time[2][2];  // days
                                time[2][1] = --time[2][1];   // months-1
                            }                         
                            if (time[2][2]<0)
                            { 
                                time[2][1] = time[2][1]-(Math.abs(time[2][2])/29+1);   // months
                                time[2][2] = time[2][2]+(Math.abs(time[2][2])/29+1)*29;  // days
                            }
                        }
                        else                            // common year
                        {
                            if (time[2][2]==0)
                            {
                                time[2][2] = 31+time[2][2];  // days
                                time[2][1] = --time[2][1];   // months-1
                            }                         
                            if (time[2][2]<0)
                            { 
                                time[2][1] = time[2][1]-(Math.abs(time[2][2])/28+1); // months
                                time[2][2] = time[2][2]+(Math.abs(time[2][2])/28+1)*28;  // days
                            }
                        }
                        break;
                }
                if (time[2][1]<0)  // months
                {
                    time[2][0] = time[2][0]-(Math.abs(time[2][1])/12+1);
                    time[2][1] = time[2][1]+(Math.abs(time[2][1])/12+1)*12; 
                }
                break;
             
            case "h":   // hours
                System.out.print("  Decrease hours by ");
                temp = input.nextInt();
                if (temp<0)
                {
                    System.out.print("Invalid hours. It should be more than 0. Reenter hours: ");
                    temp = input.nextInt();
                    time[2][3] = time[2][3]-temp;
                } else time[2][3] = time[2][3]-temp;             
                if (time[2][3]<0)
                {
                    time[2][2] = time[2][2]-(Math.abs(time[2][3])/24+1);  // decrease days
                    time[2][3] = time[2][3]+(Math.abs(time[2][3])/24+1)*24;
                }
                switch(time[2][1])  // month
                {
                    case 1:
                    case 3:
                    case 5:
                    case 7:
                    case 8:
                    case 10:
                    case 12:
                        if (time[2][2]==0)
                        {
                            switch(time[2][1])
                            {
                                case 1:
                                case 8:
                                    time[2][2] = 31+time[2][2];  // days
                                    if (time[2][1]==1)
                                    {                               
                                        time[2][1]=12;
                                        time[2][0]=--time[2][0];
                                    }
                                    else time[2][1] = --time[2][1];   // months-1
                                    break;
                                case 3:
                                    if (chkLeapYr(time[2][0]))      // leap year
                                    {
                                        time[2][2] = 29+time[2][2];  // days
                                        time[2][1] = --time[2][1];   // months-1                                     
                                    }
                                    else                             // not leap year = common year
                                    {
                                        time[2][2] = 28+time[2][2];  // days
                                        time[2][1] = --time[2][1];   // months-1                                 
                                    }
                                    break;
                                case 5:
                                case 7:
                                case 10:
                                case 12:
                                    time[2][2] = 30+time[2][2];  // days
                                    time[2][1] = --time[2][1];   // months-1
                                    break;
                            }
                        }                       
                        if (time[2][2]<0)
                        {
                            time[2][1] = time[2][1]-(Math.abs(time[2][2])/31+1);   // months
                            time[2][2] = time[2][2]+(Math.abs(time[2][2])/31+1)*31;  // days
                        }
                        break;
                    case 4:
                    case 6:
                    case 9:
                    case 11:
                        if (time[2][2]==0)
                        {
                            time[2][2] = 31+time[2][2];  // days
                            time[2][1] = --time[2][1];   // months-1
                        }                     
                        if (time[2][2]<0)
                        {
                            time[2][1] = time[2][1]-(Math.abs(time[2][2])/30+1);  // months
                            time[2][2] = time[2][2]+(Math.abs(time[2][2])/30+1)*30; // days
                        } 
                        break;
                    case 2:
                        if (chkLeapYr(time[2][0]))      // leap year
                        {
                            if (time[2][2]==0)
                            {
                                time[2][2] = 31+time[2][2];  // days
                                time[2][1] = --time[2][1];   // months-1
                            }                         
                            if (time[2][2]<0)
                            { 
                                time[2][1] = time[2][1]-(Math.abs(time[2][2])/29+1);   // months
                                time[2][2] = time[2][2]+(Math.abs(time[2][2])/29+1)*29;  // days
                            }   
                        }
                        else                            // common year
                        {
                            if (time[2][2]==0)
                            {
                                time[2][2] = 31+time[2][2];  // days
                                time[2][1] = --time[2][1];   // months-1
                            }                         
                            if (time[2][2]<0)
                            { 
                                time[2][1] = time[2][1]-(Math.abs(time[2][2])/28+1); // months
                                time[2][2] = time[2][2]+(Math.abs(time[2][2])/28+1)*28;  // days
                            }
                        }
                        break;
                }
                if (time[2][1]<0)  // months
                {
                    time[2][0] = time[2][0]-(Math.abs(time[2][1])/12+1);
                    time[2][1] = time[2][1]+(Math.abs(time[2][1])/12+1)*12;   
                }
                break;
                 
            case "D":
                System.out.print("  Decrease days by ");
                temp = input.nextInt();
                if (temp<0)
                {
                    System.out.print("Invalid days. It should be more than 0. Reenter hours: ");
                    temp = input.nextInt();
                    time[2][2] = time[2][2]-temp;
                } else time[2][2] = time[2][2]-temp;
             
                switch(time[2][1])  // month
                {
                    case 1:
                    case 3:
                    case 5:
                    case 7:
                    case 8:
                    case 10:
                    case 12:
                        if (time[2][2]==0)
                        {
                            switch(time[2][1])
                            {
                                case 1:
                                case 8:
                                    time[2][2] = 31+time[2][2];  // days
                                    if (time[2][1]==1)
                                    {                               
                                        time[2][1]=12;
                                        time[2][0]=--time[2][0];
                                    }
                                    else time[2][1] = --time[2][1];   // months-1
                                    break;
                                case 3:
                                    if (chkLeapYr(time[2][0]))      // leap year
                                    {
                                        time[2][2] = 29+time[2][2];  // days
                                        time[2][1] = --time[2][1];   // months-1                                     
                                    }
                                    else                             // not leap year = common year
                                    {
                                        time[2][2] = 28+time[2][2];  // days
                                        time[2][1] = --time[2][1];   // months-1                                 
                                    }
                                    break;
                                case 5:
                                case 7:
                                case 10:
                                case 12:
                                    time[2][2] = 30+time[2][2];  // days
                                    time[2][1] = --time[2][1];   // months-1
                                    break;
                            }
                        }                       
                        if (time[2][2]<0)
                        {
                            time[2][1] = time[2][1]-(Math.abs(time[2][2])/31+1);   // months
                            time[2][2] = time[2][2]+(Math.abs(time[2][2])/31+1)*31;  // days
                        }
                        break;
                    case 4:
                    case 6:
                    case 9:
                    case 11:
                        if (time[2][2]==0)
                        {
                            time[2][2] = 31+time[2][2];  // days
                            time[2][1] = --time[2][1];   // months-1
                        }
                        if (time[2][2]<0)
                        {
                            time[2][1] = time[2][1]-(Math.abs(time[2][2])/30+1);  // months
                            time[2][2] = time[2][2]+(Math.abs(time[2][2])/30+1)*30; // days
                        }
                        break;
                    case 2:
                        if (chkLeapYr(time[2][0]))      // leap year
                        {
                            if (time[2][2]==0)
                            {
                                time[2][2] = 31+time[2][2];  // days
                                time[2][1] = --time[2][1];   // months-1
                            }
                            if (time[2][2]<0)
                            { 
                                time[2][1] = time[2][1]-(Math.abs(time[2][2])/29+1);   // months
                                time[2][2] = time[2][2]+(Math.abs(time[2][2])/29+1)*29;  // days
                            }
                        }
                        else                            // common year
                        {
                            if (time[2][2]==0)
                            {
                                time[2][2] = 31+time[2][2];  // days
                                time[2][1] = --time[2][1];   // months-1
                            }
                            if (time[2][2]<0)
                            { 
                                time[2][1] = time[2][1]-(Math.abs(time[2][2])/28+1); // months
                                time[2][2] = time[2][2]+(Math.abs(time[2][2])/28+1)*28;  // days
                            }
                        }
                        break;
                }
                if (time[2][1]<0)  // months
                {
                    time[2][0] = time[2][0]-(Math.abs(time[2][1])/12+1);
                    time[2][1] = time[2][1]+(Math.abs(time[2][1])/12+1)*12;
                }
                break;
             
            case "M":   // Months
                System.out.print("  Decrease months by ");
                temp = input.nextInt();
                if (temp<0)
                {
                    System.out.print("Invalid month. It should be between 1 and 12. Reenter months: ");
                    temp = input.nextInt();
                    time[2][1] = time[2][1]-temp;               
                } else time[2][1] = time[2][1]-temp;
                if (time[2][1]<0)  // months
                { 
                    time[2][0] = time[2][0]-(Math.abs(time[2][1])/12+1);
                    time[2][1] = time[2][1]+(Math.abs(time[2][1])/12+1)*12;       
                }
                break;
             
            case "Y":   // Years
                System.out.print("  Decrease years by ");
                temp = input.nextInt();
                if (temp<0 | temp>9999)
                {
                    System.out.println("Invalid year. It should be between 1 and 9999. Reenter years: ");
                    temp = input.nextInt();
                    time[2][0] = time[2][0]-temp;
                } else time[2][0] = time[2][0]-temp;
                break;
            default: System.out.println("Invalid date or time!");
        }
    }
}

public class Timeside
{
    public static void main(String[] args)
    {
        String str = new String("");
        String yes="y", no="n";  // yes
        String str0="Y", str1="M", str2="D", str3="h", str4="m", str5="s";
     
        MyTime dat = new MyTime(0);
     
        dat.enterDate();
        dat.enterTime();
     
        System.out.println();
        System.out.print("Input Date & Time:  ");
            dat.displayMilTime(dat.time[0][1],dat.time[0][2],dat.time[0][0],dat.time[0][3],dat.time[0][4],dat.time[0][5]);
            System.out.println();     
     
        System.out.print("Reference Date & Time:  ");
            dat.displayStdTime(dat.time[0][1],dat.time[0][2],dat.time[0][0],dat.time[0][3],dat.time[0][4],dat.time[0][5]);
            System.out.println();

        System.out.println("By default: Increment 1 second");
        dat.increaseTime("1s");
        System.out.print("Increment Date & Time:  ");
            dat.displayMilTime(dat.time[1][1],dat.time[1][2],dat.time[1][0],dat.time[1][3],dat.time[1][4],dat.time[1][5]);
            System.out.println();
         
        System.out.println("By default: Decrement 1 second");
        dat.decreaseTime("1s");
        System.out.print("Decement Date & Time:   ");
            dat.displayMilTime(dat.time[2][1],dat.time[2][2],dat.time[2][0],dat.time[2][3],dat.time[2][4],dat.time[2][5]);
            System.out.println(); 
             
        System.out.println("Info: You can INCREASE or DECREASE Date and/or Time.");
        System.out.println();
     
        System.out.print("Do you want to INCREASE date and time?  'y' for Yes or 'n' for No: ");
        str = dat.input.next();
        if (str.equals(yes))
        {
            //System.out.println("Please select either 'Y' for years, 'M' for months,  or 'D' for days");
            //System.out.println("          and either 'h' for hours, 'm' for minutes, or 's' for seconds");
         
            //System.out.print("  Enter the selection for years: ");
            //str = "Y";
            //if (str.equals(str0))
            dat.increaseTime("Y");
         
            //System.out.print("  Enter the selection for months: ");
            //str = dat.input.next();
            //if (str.equals(str1))
            dat.increaseTime("M");
         
            //System.out.print("  Enter the selection for days: ");
            //str = dat.input.next();
            //if (str.equals(str2))
            dat.increaseTime("D");
         
            //System.out.print("  Enter the selection for hours: ");
            //str = dat.input.next(); 
            //if (str.equals(str3))
            dat.increaseTime("h");
         
            //System.out.print("  Enter the selection for minutes: ");
            //str = dat.input.next(); 
            //if (str.equals(str4))
            dat.increaseTime("m");
         
            //System.out.print("  Enter the selection for seconds: ");
            //str = dat.input.next(); 
            //if (str.equals(str5))
            dat.increaseTime("s");
         
            System.out.print("Increase Date & Time: ");
            dat.displayMilTime(dat.time[1][1],dat.time[1][2],dat.time[1][0],dat.time[1][3],dat.time[1][4],dat.time[1][5]);
            System.out.println();
        }
        else if (str.equals(no))
        {
            System.out.println("  Skip increasing date & time.");
            System.out.println();
        }
        else
        {
            System.out.println("  Incorrect response of 'y' or 'n'!");
            System.out.println();
        }
     
        System.out.print("Do you want to DECREASE date and time?  'y' for Yes or 'n' for No: ");
        str = dat.input.next();
        if (str.equals(yes))
        {
            //System.out.println("Please select either 'Y' for years, 'M' for months,  or 'D' for days");
            //System.out.println("          and either 'h' for hours, 'm' for minutes, or 's' for seconds");
         
            //System.out.print("  Enter the selection for years: ");
            //str = dat.input.next();
            //if (str.equals(str0))
            dat.decreaseTime("Y");
         
            //System.out.print("  Enter the selection for months: ");
            //str = dat.input.next();
            //if (str.equals(str1))
            dat.decreaseTime("M");
         
            //System.out.print("  Enter the selection for days: ");
            //str = dat.input.next();
            //if (str.equals(str2))
            dat.decreaseTime("D");
         
            //System.out.print("  Enter the selection for hours: ");
            //str = dat.input.next(); 
            //if (str.equals(str3))
            dat.decreaseTime("h");
         
            //System.out.print("  Enter the selection for minutes: ");
            //str = dat.input.next(); 
            //if (str.equals(str4))
            dat.decreaseTime("m");
         
            //System.out.print("  Enter the selection for seconds: ");
            //str = dat.input.next(); 
            //if (str.equals(str5))
            dat.decreaseTime("s");
         
            System.out.print("Decrease Date & Time:  ");
            dat.displayMilTime(dat.time[2][1],dat.time[2][2],dat.time[2][0],dat.time[2][3],dat.time[2][4],dat.time[2][5]);
            System.out.println();
        }
        else if (str.equals(no))
        {
            System.out.println("  Skip decreasing date & time.");
            System.out.println();
        }
        else
        {
            System.out.println("  Incorrect response of 'y' or 'n'!");
            System.out.println();
        }
     
        System.out.println("End of the progsm.");
                 
    }
}