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
No comments:
Post a Comment