Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Experts Guide To Database 2

Authors: Bruce L. Larson

1st Edition

0070232679, 978-0070232679

More Books

Students also viewed these Databases questions

Question

Explain all drawbacks of the application procedure.

Answered: 1 week ago

Question

Determine Leading or Lagging Power Factor in Python.

Answered: 1 week ago

Question

manageremployee relationship deteriorating over time;

Answered: 1 week ago