Question
Write a Java code that prints out a title, requests a name from the user, creates the verse or rhyme as indicated in the video,
Write a Java code that prints out a title, requests a name from the user, creates the verse or rhyme as indicated in the video, prints out the verse, and thanks the user for using the program. Spend some time on formatting and make this look nice.
Special Rules: Certain names make this game go from the student-friendly, family-oriented game that it is intended to be, to a surprising awakening for certain people's names. You must check first and not allow this to happen. (Mitch and Tucker are two examples.) Exit the program when someone enters the names Mitch and Tucker!
!! For names with 2 consonants at the front, remove the first 2 letters. Examples are Thanos, Philip, and Steve.
For names beginning in double vowels, remove only the first vowel. An example is Aaron.
The learning goal of this exercise is to save information in variables.
- Use Scanner to get input from the user.
- Write Java code that uses Strings and if statements or switch statements to write your rhyme.
- Comment the sections of code.
- Use the javac command to compile your code.
- Use the java command to evaluate the results of your code.
This is the rhyme of the song should be used on the code, so please write the code based on these requirements in Java and post the screenshot of your program if possible.
Do not use any method\other than directed and don't use return function or public static boolean isVowel(char c) { return c=='a'||c=='A'||c=='e'||c=='E'||c=='i'||c=='I'||c=='o'||c=='O'||c=='u'||c=='U'; }.
Please complete the code I am attaching and don't change anything I wrote, just add to it.
This is what the code needs to print after you run it, so please follow these requirements and make sure the code prints the names as following picture
import java.util.Scanner; class public static void main(String[] args) { Scanner input = new Scanner(System.in); // Prints out the statement "The Name Game!" System.out.println("The Name Game!"); // Asks user to input a name. System.out.print("Enter a name: "); name = input.nextLine(); String name1 = name.substring(1); if (name.contains ("itch") || name.contains ("uck")) { System.exit(0); }//end if if (name.substring(0,2).contains("Th") || name.substring(0,2). contains ("Sh"), || name.substring(0,2).contains ("Ch") | name.substring(0,2). contains ("Ph")) ramo Lincoln Bincoln vanos Fincoln Panos Mincoln Nam Game Checklist Barney--arney Thanas bunt Farney Marney - Manos Fran - Bran Philip-Bilip - ran Mran Arnold - Barnold arn Miles - Biles Files -iles Marnold Aaron - Baron Faron Maron Mitch-ends game Tucker-ends game
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