Tuesday, October 25, 2016

Civil Status Checker in C#

Hi there in this article I would like to share with you a very simple program that will check the civil status of a person whether the person is single, married, widow, annulled or separated from their spouse. What does the program do is to ask the users name and then it will give a selection of values 1 for single, 2 for married, 3 for widow, 4 - annulled and 5 - separated. If the user invalid value our program will also the user that the value that is being provided is invalid. The purpose of this program is to teach the person understand if else compounded statement in C#. I hope you will find my work useful. Thank you very much.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

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

My mobile number here in the Philippines is 09173084360.







Sample Program Output

Program Listing

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

// Program : Civil Status Checker in C#
// Author  : Mr. Jake R. Pomperada, MAED-IT
// Date    : October 25, 2016  Tuesday


namespace civil_status
{
    class civil_status
    {
        static void Main(string[] args)
        {
            int status = 0;
            string reply;
            int n = 0;
            String user;

            do {
            Console.Clear();
            Console.Write("\n\n");
            Console.Write("\t Civil Status Checker");
            Console.Write("\n\n");
            Console.Write("What is your name : ");
            user = Console.ReadLine();
            Console.Write("\n");
            Console.WriteLine("1 - Single 2 - Married 3 - Widow 4 - Annulled 5 - Separated ");
            Console.Write("\n");
            Console.Write("What is your Civil Status : ");
            status = Convert.ToInt32(Console.ReadLine());
            Console.Write("\n");
                     
            if (status == 1) {
                   Console.Write("\n");
                   Console.Write(" Hi {0} you are still Single. ",user);
                }

            else  if (status == 2) {
                   Console.Write("\n");
                   Console.Write(" Hi {0} you are already Married. ",user);
                }
            else if (status == 3) {
                   Console.Write("\n\n");
                   Console.Write(" Hi {0} you are already Widow. ",user);
                }
            else  if (status == 4) {
                   Console.Write("\n");
                   Console.Write(" Hi {0} you are already Annulled in your marriage.",user);
                }
            else  if (status == 5) {
                   Console.Write("\n\n");
                   Console.Write(" Hi {0} you are already Separated from your Spouse. ",user);
                }
            else {
                   Console.Write("\n");
                   Console.Write(" Hi {0} you are already Separated from your Spouse. ",user);
            }
                 Console.Write("\n\n");
                Console.Write("Do You Want To Continue? Y/N : ");
                reply = Console.ReadLine();

                if (reply == "y" || reply == "Y")
                {
                    continue;
                }
                else if (reply == "n" || reply == "N")
                {
                    Console.Write("\n\n");
                    Console.Write("Thank You For Using This Software.");
                    Console.Write("\n\n");
                    Console.ReadLine();
                    break;
                }
         
           } while (n == 0);
        }
    }
}  // End of Program







Array Input and Output in C#

Here is a short and simple program that I wrote in C# that will show you how to use one dimensional array. In this program it will ask the user to give five numbers. The five given number by our user will display at the screen using one dimensional array as our data structu

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

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

My mobile number here in the Philippines is 09173084360.




Sample Program Output

Program Listing


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace array_input_output
{
    class array_input_output
    {
        static void Main(string[] args)
        {
            int[] rollno = new int[6];
            Console.Write("Array Input and Output in C#");
            Console.Write("\n\n");
           
            for (int s = 1; s <=5 ; s++)
            {
                Console.Write("Enter value in item no. {0} : ", s);
               rollno[s] = Convert.ToInt32(Console.ReadLine());
             }
            Console.Write("\n\n");
            Console.Write("The List of Items Values ");
            Console.Write("\n\n");
            for (int j = 1; j <= 5; j++)
            {
                Console.Write(" {0} ", rollno[j]);
            }
            Console.Write("\n\n");
            Console.Write(" End of Program ");
            Console.ReadLine();
        }
    }
}




Monday, October 24, 2016

Prime Number Checker in C#

Here is a very simple program that I wrote using C# programming language that will ask the user to give a positive number and then our program will check and determine if the given number by the user is a prime number or not. The code is very short and easy to understand.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

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

My mobile number here in the Philippines is 09173084360.



Sample Program Output


Program Listing


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace prime_number
{
    class prime_number
    {
        static void Main(string[] args)
        {
            string reply;
            int n = 0;
            int num_value = 0;
            int i=0, flag = 0;

            do
            {
                Console.Clear();
                Console.Write("Prime Number Checker ");
                Console.Write("\n\n");
                Console.Write("Enter a Positive Number : ");
                num_value = Convert.ToInt32(Console.ReadLine());

                for (i = 2; i <= num_value / 2; ++i)
                {
                    // Condition in checking non prime numbers
                    if (num_value % i == 0)
                    {
                        flag = 1;
                        break;
                    }
                }

                if (flag == 0)
                {
                    Console.Write("\n\n");
                    Console.Write("{0} is a Prime Number.", num_value);
                }
                else
                {
                    Console.Write("\n\n");
                    Console.Write("{0} is Not a Prime Number.", num_value);
                }
    
                Console.Write("\n\n");
                Console.Write("Do You Want To Continue? Y/N : ");
                reply = Console.ReadLine();

                if (reply == "y" || reply == "Y")
                {
                    continue;
                }
                else if (reply == "n" || reply == "N")
                {
                    Console.Write("\n\n");
                    Console.Write("Thank You For Using This Software.");
                    Console.Write("\n\n");
                    break;
                }

            } while (n == 0);
            Console.ReadLine();
        }
    }
}



Days of the Week Using C#

In this article I would like to share with you a sample program that will ask the user to give a number between 1 to 7 and then our program will check if the given number by the user what day it belongs to. For example the user give 1 it will fall on Monday as day of the week. The code demonstrate how to use switch statement in C# programming language. I hope you will find my work useful. Thank you.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

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

My mobile number here in the Philippines is 09173084360.




Sample Program Output

Program Listing


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

// Print day of the week using switch statement

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int days = 0;

            Console.Clear();
            Console.Write("\n\n");
            Console.Write("Days of the Week Program ");
            Console.Write("\n\n");
            Console.Write("Give the number between 1 to 7 :  ");
            days = Convert.ToInt32(Console.ReadLine());
            Console.Write("\n\n");
                    
            switch (days)
            {

                case 1: Console.Write("The day you have selected in Sunday.");
                        break;

                case 2: Console.Write("The day you have selected in Monday.");
                        break;

                case 3: Console.Write("The day you have selected in Tuesday.");
                        break;

                case 4: Console.Write("The day you have selected in Wednesday.");
                        break;

                case 5: Console.Write("The day you have selected in Thursday.");
                        break;

                case 6: Console.Write("The day you have selected in Friday.");
                        break;

                case 7: Console.Write("The day you have selected in Saturday.");
                        break;

               default: Console.Write("Invalid Day. Please Try Again.");
                        break;
             }
            Console.Write("\n\n");
            Console.Write("End of Program.");
            Console.Write("\n\n");
            Console.ReadLine();
        }
    }
}

Thursday, October 20, 2016

Resume Maker in C++

A very simple program that I wrote before in C++ to create a simple resume when I started learning C++ programming. It uses text file to store information give by our user. I hope you will find my work useful.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

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

My mobile number here in the Philippines is 09173084360.



Program Listing

#include <iostream>
#include <fstream>

using namespace std;

main() {
     string name,course, school, position;
     int age=0;

     cout << " ======= Resume Maker Version 1.0 =============";
     cout << "\n\n";

     cout << "Enter the name of the Person : ";
     getline(cin,name);
     cout << "Enter the age of the Person : ";

     cin >> age;

     cout << "Enter the course of the Person : ";
    cin.ignore(80,'\n');
    getline(cin,course);

     cout << "Enter the school Graduated  : ";
     getline(cin,school);
     cout << "Enter the Position Applying : ";
     getline(cin,position);

     cout << "\n\n";
     cout << "\t  RECORDS HAS BEEN SAVED IN THE DATABASE";

    ofstream my_file("resume.txt");
    my_file << "\n\n\t\t ==== RESUME VITAE ==== ";
    my_file << "\n\n";
    my_file << "\n \t Name      :  " <<name;
    my_file << "\n \t Age       :  " <<age;
    my_file << "\n \t Course    :  " <<course;
    my_file << "\n \t School    :  " <<school;
    my_file << "\n \t Position  :  " <<position;

    my_file.close();
    return 0;
}




Year Level Checker in C#

Hi there in this article I would like to share with you our simple program will ask the user to give the year level where the student is belong to like freshmen, sophomore, juniors and seniors. Using if else statement in C#. I also make sure that if the user gives a letter or special character our program will not crash and inform the user to provide valid input value like a number. I hope you will find my work useful in learning C#  programming. Thank you.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

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


My mobile number here in the Philippines is 09173084360.


Sample Program Outpu




Program Listing


using System;

using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace year_level
{
    class year_level
    {
        static void Main(string[] args)
        {
            
            string input;
            int year = 0;
            bool result = false;
    
                while (result == false)
                {
                    Console.Write("\n\n");
                    Console.Write("Year Level Checker ");
                    Console.Write("\n\n");
                    Console.Write("Enter Your Year Level : ");
                    input = Console.ReadLine();
                    result = int.TryParse(input, out year);
                    if (result == false)
                    {
                        Console.Write("\n");
                        Console.Write("Please Enter Numbers Only.");
                    }
                    else if (year == 1)
                    {
                        Console.Write("\n\n");
                        Console.Write("You are belong to Freshment.");
                        break;
                    }
                    else if (year == 2)
                    {
                        Console.Write("\n\n");
                        Console.Write("You are belong to Sophomore.");
                        break;
                    }
                    else if (year == 3)
                    {
                        Console.Write("\n\n");
                        Console.Write("You are belong to Juniors.");
                        break;
                    }
                    else if (year == 4)
                    {
                        Console.Write("\n\n");
                        Console.Write("You are belong to Senior.");
                        break;
                    }
                    else
                    {
                        Console.Write("\n\n");
                        Console.Write("Invalid Year Level. Try Again.");
                        result = false;
                        
                    }

                }
                         
                    Console.Write("\n\n");
                    Console.Write("Thank You For Using This Software.");
                    Console.Write("\n\n");
                    Console.ReadLine();
        }
    }
}

String of Arrays in C++

Here is a sample program that I wrote a long time ago to show how to display a series of names of countries around the world using two dimensional array, strings and character in C++. The code is very short and easy to understand.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

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

My mobile number here in the Philippines is 09173084360.


Program Listing

#include <iostream>

using namespace std;


int main()

{

char Country[6][15] = { "America", "Japan", "Zimbabwe",

                     "Sri Lanka", "Philippines",
                      "El Salvador" };

cout << "\t\t ARRAY OF STRINGS 1.0";
cout << "\n";
cout << "\n\tCreated By: Mr. Jake R. Pomperada, MAED-IT";
cout << "\n\nLIST OF COUNTRY NAMES";
    cout << "\n\n";
for(int i = 0; i < 6; ++i)

cout << "\nCountry " << i + 1 << ": " << Country[i];



cout << "\n\n";

return 0;

}