A very simple program that I wrote in Java using NetBeans IDE to ask the user it's civil status whether the user is single, married, divorce or annulled it will display the result on the screen. The program is very simple I just wrote this for beginners that are new in Java programming.
I hope you will find my work useful and beneficial. If you have some questions about programming, about my work please send me an email at jakerpomperada@gmail.comand jakerpomperada@yahoo.com. People here in the Philippines can contact me at my mobile number 09173084360.
Thank you very much and Happy Programming.
Sample Program Output
Program Listing
/*
civil_status.java
Programmer By: Mr. Jake R. Pomperada, MAED-IT
Date : July 20, 2015
Tools: NetBeans 8.0.2, Java SE 8.0
Problem No. 3:
Write a program check the civil status of a person either the person
is SINGLE, MARRIED, ANNULLED, SEPARATED or WIDOW.
*/
import java.util.Scanner;
class civil_status {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
char ch;
do {
char selected_status=0;
System.out.print("Civil Status Checker ");
System.out.println();
String user_name = input.nextLine();
System.out.print("Enter your Name : ");
String user_name2 = input.nextLine();
System.out.println("Select Your Civil Status ");
System.out.print("1 - SINGLE, 2 - MARRIED, 3 - ANNULLED"
+ ", 4 - SEPARATED, 5 - WIDOW : ");
selected_status = input.next().charAt(0);
if (selected_status == '1') {
System.out.println();
System.out.print("Hi " + user_name2 + " you are still Single.");
}
else if (selected_status == '2') {
System.out.println();
System.out.println("Hi " + user_name2 + " you are already Married.");
}
else if (selected_status == '3') {
System.out.println();
System.out.print("Hi " + user_name2 + " you are already Annulled.");
}
else if (selected_status == '4') {
System.out.println();
System.out.print("Hi " + user_name2 + " you are already Separated.");
}
else if (selected_status == '5') {
System.out.println();
System.out.print("Hi " + user_name2 + " you are already Widow.");
}
else {
System.out.println("Sorry Invalid Option Try Again.");
}
System.out.print("\nDo you want to continue (Type y or n) : ");
ch = input.next().charAt(0);
} while (ch == 'Y'|| ch == 'y');
System.out.println();
System.out.print("\t THANK YOU FOR USING THIS PROGRAM");
System.out.println("\n\n");
}
}