Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Scanner;
- public class Website_Checker {
- public static void main(String[] args){
- Scanner input = new Scanner(System.in);
- System.out.print("Input a website address:");
- String sentence = input.nextLine();
- switch((sentence.substring(sentence.length() - 4)))
- {
- case ".com":
- System.out.print("Commercial.");
- break;
- case ".gov":
- System.out.print("Government.");
- break;
- case ".edu":
- System.out.print("Education.");
- break;
- case ".org":
- System.out.print("Organization.");
- break;
- default:
- System.out.print("Unknown / Invalid.");
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment