I need to write a simple nickname creation GUI using JFrame and/or JSwing. When
ID: 3637484 • Letter: I
Question
I need to write a simple nickname creation GUI using JFrame and/or JSwing. When the user enters their name the program takes the string length and assigns a nickname based on that length. For example if the name entered has 3 or less characters the nickname is “Boy”, but if the name has 4 characters then the nickname is “Baby”, but if the name has 5 characters then the nickname is “Sugar”, but if the name has at least 6 characters or more then the nickname is “Sweety”. There must be at least four different nicknames for four different string lengths.Explanation / Answer
package nickname; import javax.swing.JOptionPane; public class inputbox { public static void main (String[] args) { String name; String nickname; int slen; name= JOptionPane.showInputDialog("Enter your name to create a nickname"); slen=name.length(); if (slenRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.