Question
import java.util.Scanner; interface display { // method to display the data String show(); } abstract class UserDetails implements display { private String name; public UserDetails(String
import java.util.Scanner; interface display { // method to display the data String show(); }
abstract class UserDetails implements display { private String name;
public UserDetails(String name) { this.name = name; }
public String getName() { return name; } }
class Alphabet extends UserDetails { private String message;
public Alphabet(String name) { super(name); }
@Override public String show() { return "User :" + super.getName() + " have entered " + message; }
public void isVowel(char letter) { if((letter >='a' && letter <= 'z') || (letter >='A' && letter <= 'Z')) { checkVowel(letter); return; } throw new IllegalArgumentException("Not an alphabet"); }
private void checkVowel(char character) { switch (character) { case 'a': case 'e': case 'i': case 'o': case 'u': case 'A': case 'E': case 'I': case 'O': case 'U': message = " a vowel"; break; default: message = " a consonent"; } } } public class Game { public static void main(String[] args) { Alphabet alphabet = new Alphabet("Rehan"); System.out.println("WELCOME TO VOWEL FINDER"); System.out.println("Enter an Alphabet"); char alpha = new Scanner(System.in).next().charAt(0);
try { alphabet.isVowel(alpha); System.out.println(alphabet.show()); } // exception handling catch (IllegalArgumentException e) { System.out.println("Exception: " + e.getMessage()); } } }
Sir i need some one how can convert this in Gui plzzzz or can create any other small project like that using below topics
inheritance
abstraction
interface
exceptional handling
Gui ( easy one ) plzzzz
must cover these topics if you are creating new any other small system or project and must display comments. plzz easy and small using above 5 topic
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started