Wednesday, December 27, 2017

Multiple Button Events in Android

While learning Android programming one of the problem that I encounter is how to assign multiple buttons in an activity and event when I click a particular button. Here is the solution that I wrote I called this application multiple button events in Android. I hope you will find my work useful.

I am currently accepting programming and web development work kindly contact me in the following email address for further details. Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental is (034) 4335675.









Sample Program Output



Program Listing

MainActivity.java

package com.example.jacob.myapplication;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;


import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity implements        View.OnClickListener {

  
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        Button one = (Button) findViewById(R.id.button);
        one.setOnClickListener(this);
        Button two = (Button) findViewById(R.id.button2);
        two.setOnClickListener(this);
        Button three = (Button) findViewById(R.id.button3);
        three.setOnClickListener(this);
        Button four = (Button) findViewById(R.id.button4);
        four.setOnClickListener(this);
        Button five = (Button) findViewById(R.id.button5);
        five.setOnClickListener(this);
    }
        @Override
        public void onClick (View v){

            switch (v.getId()) {

                case R.id.button:
                    Toast.makeText(MainActivity.this, "You have clicked Button 1", Toast.LENGTH_LONG).show();
                    break;

                case R.id.button2:
                    Toast.makeText(MainActivity.this, "You have clicked Button 2", Toast.LENGTH_LONG).show();
                    break;

                case R.id.button3:
                    Toast.makeText(MainActivity.this, "You have clicked Button 3", Toast.LENGTH_LONG).show();
                    break;

                case R.id.button4:
                    Toast.makeText(MainActivity.this, "You have clicked Button 4", Toast.LENGTH_LONG).show();
                    break;

                case R.id.button5:
                    Toast.makeText(MainActivity.this, "You have clicked Button 5", Toast.LENGTH_LONG).show();
                    break;
                default:
                    break;
            }



        }

    }


activity_main.xml

<?xml version="1.0" encoding="utf-8"?><android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:app="http://schemas.android.com/apk/res-auto"    xmlns:tools="http://schemas.android.com/tools"    android:layout_width="match_parent"    android:layout_height="match_parent"    tools:context="com.example.jacob.myapplication.MainActivity">

    <RelativeLayout        android:layout_width="440dp"        android:layout_height="587dp"        tools:layout_editor_absoluteX="16dp"        tools:layout_editor_absoluteY="0dp">

        <Button            android:id="@+id/button"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_alignParentStart="true"            android:layout_alignParentTop="true"            android:layout_marginStart="80dp"            android:layout_marginTop="44dp"            android:text="Button 1" />

        <Button            android:id="@+id/button2"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_alignStart="@+id/button"            android:layout_below="@+id/button"            android:layout_marginTop="61dp"            android:text="Button 2" />

        <Button            android:id="@+id/button3"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_alignStart="@+id/button2"            android:layout_below="@+id/button2"            android:layout_marginTop="55dp"            android:text="Button 3" />

        <Button            android:id="@+id/button4"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_alignStart="@+id/button3"            android:layout_below="@+id/button3"            android:layout_marginTop="57dp"            android:text="Button 4"            tools:layout_editor_absoluteX="67dp"            tools:layout_editor_absoluteY="0dp" />

        <Button            android:id="@+id/button5"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_alignEnd="@+id/button4"            android:layout_below="@+id/button4"            android:layout_marginTop="44dp"            android:text="Button 5" />
    </RelativeLayout>
</android.support.constraint.ConstraintLayout>


strings.xml

<resources>
    <string name="app_name">Multiple Buttons in Android</string>
</resources>




DOWNLOAD SOURCE CODE HERE
























Monday, December 25, 2017

Temperature Converter in Android

In this article I would like to share with you my newest application that I wrote using Android I called this program temperature converter using Android. It allows the user to convert temperature from Fahrenheit to Celsius and Celsius to Fahrenheit. I am still a beginner in android programming but I found it very useful and enjoyable way to learn how to program. I hope you will find my work useful.

 I am currently accepting programming and web development work kindly contact me in the following email address for further details. Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental is (034) 4335675.






Sample Program Output



Program Listing

MainActivity.java

package com.example.jacob.temperature_converter;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.RadioButton;
import android.widget.Toast;
import android.text.TextUtils;
import android.widget.Button;




public class MainActivity extends AppCompatActivity {

    double temp_given;


    public void About(View v) {

        startActivity(new Intent(this, About.class));
    }



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main); }




   public void convert_temp(View V) {

        final TextView result = (TextView) findViewById(R.id.textView);
        final EditText temp = (EditText) findViewById(R.id.editText2);
        final RadioButton fahToCelsius = (RadioButton) findViewById(R.id.radFahToCelsius);

        final RadioButton celToFahrenheit = (RadioButton) findViewById(R.id.radCelToFahrenheit);

        temp_given = Double.parseDouble(temp.getText().toString());


        if (fahToCelsius.isChecked()) {


            double convert_celsius = ((temp_given - 32) * 5 / 9);

            String str = String.format("%5.2f", convert_celsius);
            double display_result = Double.valueOf(str);

            result.setText(String.valueOf(display_result) + " degrees Celsius.");

            fahToCelsius.setChecked(false);


        }

        if (celToFahrenheit.isChecked()) {

            double convert_fahrenheit = ((temp_given * 9 / 5) + 32);

            String str = String.format("%5.2f", convert_fahrenheit);
            double display_result = Double.valueOf(str);

            result.setText(String.valueOf(display_result) + " degrees Fahrenheit.");

            celToFahrenheit.setChecked(false);

        }
    }
}


About.java

package com.example.jacob.temperature_converter;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

public class About extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_about);
    }
}



activity_main.xml

<?xml version="1.0" encoding="utf-8"?><android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.jacob.temperature_converter.MainActivity">

    <RelativeLayout
        android:layout_width="381dp"
        android:layout_height="504dp"
        app:layout_constraintEnd_toEndOf="parent"
        tools:layout_editor_absoluteY="3dp">

        <EditText
            android:id="@+id/editText2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentStart="true"
            android:layout_alignParentTop="true"
            android:layout_marginStart="23dp"
            android:layout_marginTop="35dp"
            android:ems="10"
            android:hint="Enter Temperature"
            android:inputType="number"
            android:textAppearance="@style/TextAppearance.AppCompat.Headline" />


        <Button
            android:id="@+id/button2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_alignStart="@+id/radCelToFahrenheit"
            android:layout_marginBottom="43dp"
            android:onClick="About"
            android:text="About This Program"
            android:textAppearance="@style/TextAppearance.AppCompat.Headline" />

        <TextView
            android:id="@+id/textView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentEnd="true"
            android:layout_alignStart="@+id/btnConvert"
            android:layout_below="@+id/btnConvert"
            android:layout_marginTop="35dp"
            android:textAppearance="@style/TextAppearance.AppCompat.Headline"
            tools:layout_editor_absoluteX="144dp"
            tools:layout_editor_absoluteY="511dp" />

        <RadioGroup
            android:id="@+id/radioGroup"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignStart="@+id/editText2"
            android:layout_below="@+id/editText2" />


        <RadioButton
            android:id="@+id/radFahToCelsius"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignStart="@+id/radioGroup"
            android:layout_below="@+id/radioGroup"
            android:layout_marginTop="30dp"
            android:text="Fahrenheit To Celsius"
            android:textAppearance="@style/TextAppearance.AppCompat.Headline" />


        <RadioButton
            android:id="@+id/radCelToFahrenheit"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignStart="@+id/radFahToCelsius"
            android:layout_below="@+id/radFahToCelsius"
            android:layout_marginTop="34dp"
            android:text="Celsius To Fahrenheit"
            android:textAppearance="@style/TextAppearance.AppCompat.Headline" />

        <Button
            android:id="@+id/btnConvert"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/radCelToFahrenheit"
            android:layout_marginTop="39dp"
            android:layout_toEndOf="@+id/radioGroup"
            android:onClick="convert_temp"
            android:text="Convert Temperature"
            android:textAppearance="@style/TextAppearance.AppCompat.Headline" />

    </RelativeLayout>
</android.support.constraint.ConstraintLayout>


activity_about.xml

<?xml version="1.0" encoding="utf-8"?><android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:app="http://schemas.android.com/apk/res-auto"    xmlns:tools="http://schemas.android.com/tools"    android:layout_width="wrap_content"    android:layout_height="wrap_content"    tools:context="com.example.jacob.temperature_converter.About">


    <RelativeLayout        android:layout_width="382dp"        android:layout_height="495dp"        tools:layout_editor_absoluteX="0dp"        tools:layout_editor_absoluteY="0dp">

        <TextView            android:id="@+id/textView6"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_alignParentEnd="true"            android:layout_alignParentTop="true"            android:layout_marginEnd="68dp"            android:layout_marginTop="22dp"            android:text="About This Program"            android:textAppearance="@style/TextAppearance.AppCompat.Headline" />

        <ImageView            android:id="@+id/imageView5"            android:layout_width="216dp"            android:layout_height="320dp"            android:layout_alignStart="@+id/textView6"            android:layout_alignTop="@+id/textView6"            app:srcCompat="@drawable/me"            tools:layout_editor_absoluteX="82dp"            tools:layout_editor_absoluteY="0dp" />

        <TextView            android:id="@+id/textView7"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_alignParentBottom="true"            android:layout_alignParentStart="true"            android:text="This program was design and developed by Mr. Jake R. Pomperada. I live in Bacolod City, Negros Occidental Philippines. \n\nYou can email me in the following address jakerpomperada@yahoo.com and jakerpomperada@gmail.com  \n\nThank you for using this software."            android:textAppearance="@style/TextAppearance.AppCompat.Medium"            android:textStyle="bold" />


    </RelativeLayout>

</android.support.constraint.ConstraintLayout>


DOWNLOAD SOURCE CODE HERE

DOWNLOAD APK FILE HERE








Thursday, December 21, 2017

Area of the Circle Solver in Android

I wrote this program to continue my study on Android programming it is not an easy task for me but I have learned many things in doing this simple program. What does the program will do is to ask the user to give the radius of the circle and then our program will compute it's area equivalent. The code is very simple and easy to understand.

 I am currently accepting programming and web development work kindly contact me in the following email address for further details. Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental is (034) 4335675.





Sample Program Output


Program Listing


content_main.xml

<?xml version="1.0" encoding="utf-8"?><android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context="com.example.jacob.areaofthecirclesolver.MainActivity"
    tools:showIn="@layout/activity_main">

    <RelativeLayout
        android:layout_width="389dp"
        android:layout_height="515dp"
        android:background="@android:color/background_light"
        tools:layout_editor_absoluteX="0dp"
        tools:layout_editor_absoluteY="0dp">

        <TextView
            android:id="@+id/textView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentEnd="true"
            android:layout_alignParentTop="true"
            android:layout_marginEnd="60dp"
            android:layout_marginTop="33dp"
            android:text="Area of the Circle Solver"
            android:textAppearance="@style/TextAppearance.AppCompat.Headline" />

        <TextView
            android:id="@+id/textView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignEnd="@+id/textView"
            android:layout_below="@+id/textView"
            android:layout_marginEnd="84dp"
            android:layout_marginTop="12dp"
            android:text="Created By"
            android:textAppearance="@style/TextAppearance.AppCompat.Body2" />

        <TextView
            android:id="@+id/textView3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignEnd="@+id/textView"
            android:layout_below="@+id/textView2"
            android:layout_marginEnd="15dp"
            android:layout_marginTop="11dp"
            android:text="Mr. Jake R. Pomperada, MAED-IT"
            android:textAppearance="@style/TextAppearance.AppCompat.Body2"
            android:tooltipText="Authoer of the Program" />

        <TextView
            android:id="@+id/textView4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/textView3"
            android:layout_marginTop="36dp"
            android:layout_toStartOf="@+id/editText"
            android:text="Give the radius :"
            android:textAppearance="@style/TextAppearance.AppCompat.Large" />

        <EditText
            android:id="@+id/editText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/textView4"
            android:layout_alignStart="@+id/textView2"
            android:layout_marginStart="12dp"
            android:ems="10"
            android:inputType="textPersonName"
            android:textAppearance="@style/TextAppearance.AppCompat.Large" />

        <Button
            android:id="@+id/button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignStart="@+id/textView4"
            android:layout_below="@+id/textView4"
            android:layout_marginTop="53dp"
            android:onClick="solve_area"
            android:text="Calculate"
            android:textAppearance="@style/TextAppearance.AppCompat.Headline"
            android:tooltipText="Click here to solve."
            tools:ignore="HardcodedText,OnClick" />

        <Button
            android:id="@+id/button2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBaseline="@+id/button"
            android:layout_alignBottom="@+id/button"
            android:layout_alignEnd="@+id/textView3"
            android:layout_marginEnd="14dp"
            android:onClick="clear_textbox"
            android:text="Clear"
            android:textAppearance="@style/TextAppearance.AppCompat.Headline" />

    </RelativeLayout>
</android.support.constraint.ConstraintLayout>


MainActivity.java

package com.example.jacob.areaofthecirclesolver;

import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.EditText;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {


    public void solve_area(View view) {
        EditText editText = (EditText) findViewById(R.id.editText);

        int value_area = Integer.valueOf(editText.getText().toString());

       double area_solve = java.lang.Math.PI*value_area*value_area;

        String str = String.format("%5.2f", area_solve);
        double display_result = Double.valueOf(str);

       Toast.makeText(this,"The area of the circle is " + String.valueOf(display_result)+".", Toast.LENGTH_SHORT).show();
    }


    public void clear_textbox(View view) {
        EditText editText = (EditText) findViewById(R.id.editText);
        editText.setText("");
        editText.requestFocus();

    }
    @Override    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override            public void onClick(View view) {
                Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                        .setAction("Action", null).show();
            }
        });
    }

    @Override    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.        getMenuInflater().inflate(R.menu.menu_main, menu);
        return true;
    }

    @Override    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will        // automatically handle clicks on the Home/Up button, so long        // as you specify a parent activity in AndroidManifest.xml.        int id = item.getItemId();

        //noinspection SimplifiableIfStatement        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }
}


strings.xml

<resources>
    <string name="app_name">Area of the Circle Solver</string>
    <string name="action_settings">Settings</string>
</resources>




Monday, December 18, 2017

Capture a File in Visual Basic NET

Here is a program being given to us by a good friend of mine and also a software developer Mr. Ferlito Daguro written in Visual Basic NET he called his program Capture a File in Visual Basic NET. I would like to thank my friend Mr. Daguro for sharing his programs to us.

 I am currently accepting programming and web development work kindly contact me in the following email address for further details. Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental is (034) 4335675.




Sample Program Output







Capture and Load XML Using Visual Basic NET

Here is a program being given to us by a good friend of mine and also a software developer Mr. Ferlito Daguro written in Visual Basic NET he called his program Capture and Load XML Using Visual Basic NET. I would like to thank my friend Mr. Daguro for sharing his programs to us.

 I am currently accepting programming and web development work kindly contact me in the following email address for further details. Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental is (034) 4335675.




Sample Program Output




Drag and Drop Application Launcher in Visual Basic NET

Here is a program being given to us by a good friend of mine and also a software developer Mr. Ferlito Daguro written in Visual Basic NET he called his program Drag and Drop Application Launcher. I would like to thank my friend Mr. Daguro for sharing his programs to us.

 I am currently accepting programming and web development work kindly contact me in the following email address for further details. Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental is (034) 4335675.






Sample Program Output








Copying Drag and Drop in Visual Basic NET

Here is a program being given to us by a good friend of mine and also a software developer Mr. Ferlito Daguro written in Visual Basic NET he called his program copying drag and drop. I would like to thank my friend Mr. Daguro for sharing his programs to us.

 I am currently accepting programming and web development work kindly contact me in the following email address for further details. Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental is (034) 4335675.



Sample Program Output











Friday, December 15, 2017

Count Vowels in Ruby

Here is a simple program that will ask the user to give a string and then our program will count the number of vowels based on the given string of our user using Ruby as our programming language.

 I am currently accepting programming and web development work kindly contact me in the following email address for further details. Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental is (034) 4335675.





Sample Program Output


Program Listing

vowels.rb


# vowels.rb
# Written By: Mr. Jake R. Pomperada, MAED-IT
# December 15, 2017
# Tool : Ruby and Sublime Text Editor
# Location : Bacolod City, Negros Occidental Philippines

# method to count the vowels in the given sentence by our user.

def count_vowels(string)
    vowels = 0
    counter = 0
    while counter < string.length do
      if string[counter]=="a" || string[counter]=="e" || string[counter]=="i" || string[counter]=="o" || string[counter]=="u"
        vowels += 1
      end
      counter += 1
    end
    return vowels
end

string_input =""
answer = ""

until answer.downcase == "n" do 
 print "\n\n"
 print "===== COUNT VOWELS IN RUBY ====="
 print "\n\n"
 print "Created by Mr. Jake R. Pomperada"
 print "\n\n"
 print "Give a sentence : "
 string_input = gets.chop

 display_result =count_vowels(string_input.downcase)

print "\n\n"
print "The number of vowels is #{display_result}."
print "\n\n"
 print "Do you want to continue Y/N ? : "
 answer= gets.chop
end  
 print "\n\n"
    print "End of Program"
    print "\n\n"



Area of the Circle Solver in Ruby

A very simple program that I wrote to solve the area of the circle. What does the program will do is to ask the user to give the value in radius of the circle and it will solve it's area the code in Ruby is very simple and easy to understand.

in the following email address for further details. Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental is (034) 4335675.




Sample Program Output


Program Listing

area.rb


# area.rb
# Written By: Mr. Jake R. Pomperada, MAED-IT
# December 15, 2017
# Tool : Ruby and Sublime Text Editor
# Location : Bacolod City, Negros Occidental Philippines

# method to compute the area of a circle

def solve_area(radius)
  area_circle = (3.1415 * radius.to_f  * radius.to_f  )
  print "\n\n"
  print "The area of circle is #{area_circle.round(2)}."
  print "\n\n"
end

radius_input =""
answer = ""

until answer.downcase == "n" do 
 print "\n\n"
 print "===== AREA OF THE CIRCLE SOLVER IN RUBY ====="
 print "\n\n"
 print "Created by Mr. Jake R. Pomperada"
 print "\n\n"
 print "Give the radius of the Circle : "
 radius_input = gets.to_i

 solve_area(radius_input)

 print "\n"
 print "Do you want to continue Y/N ? : "
 answer= gets.chop
end  
 print "\n\n
 print "End of Program"
 print "\n\n"