Sunday, June 30, 2019

Gender Checker Using If - Else Statement in Java

A simple gender check using if - else statement using Java programming language.

If you like my work please click the ads on my website to support my work. I will really appreciate your help. 

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.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 Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com


Program Listing

package year_level;
import java.util.Scanner;

public class Year_Level {
/**
 * Year_Level.java
 * Author : Mr. Jake R. Pomperada,MAED-IT
 * Date   : February 19, 2019   Tuesday
 * http://www.jakerpomperada.com
 * jakerpomperada@jakerpomperada.com 
 * jakerpomperada@gmail.com
 */
    public static void main(String[] args) {
       char gender;
      char Gender_Checker;
 
      Scanner input = new Scanner(System.in);
      System.out.println();
      System.out.print("\t\tGender Checker");
      System.out.println("\n");
      System.out.print("\tWhat is Your Gender? M-Male or F-Female : ");
      gender = input.next().charAt(0); 
      
      System.out.println();
      Gender_Checker = Character.toUpperCase(gender);
      
           
      if (Gender_Checker == 'M')
      {
       System.out.println();
       System.out.println("\tYour Gender is MALE.");
      }
      
      if (Gender_Checker == 'F')
      {
       System.out.println();   
       System.out.println("\tYour Gender is FEMALE.");
      }
      
      if (Gender_Checker != 'M'  && Gender_Checker != 'F')
      {
       System.out.println("\tInvalid Gender Try Again.");
      }
      
      System.out.println("\n");
      System.out.println("\tEnd of Program");
      System.out.println();
    }
    
}

No comments:

Post a Comment