banana fee fi fo fana song


questioned by maham237 @ in Computers & Technology viewed by 882 People


Modify songVerse to play "The Name Game" (see OxfordDictionaries), by replacing "(Name)" with userName but without the first letter. Ex: If userName = "Kaitlin" and songVerse = "Banana-fana fo-f(Name)!", the program prints: Banana-fana fo-faitlin! Ex: If userName = "Kaitlin" and songVerse = "Fee fi mo-m(Name)", the program prints: Fee fi mo-maitlin Note: You may assume songVerse will always contain the substring "(Name)".

Answered by maham237 @



Answer:

Following are the modification of the code:

import java.util.*;//import package for user input

public class NameSong //defining NameSong

{

public static void main (String [] args) //defining the main method

{

String userName,songVerse;//defining string variable

Scanner obxc = new Scanner(System.in);//creating Scanner class object

userName = obxc.nextLine();//input string value

songVerse = obxc.nextLine();//input string value

userName = userName.substring(1); // Removes first char from userName

songVerse = songVerse.replace("(Name)",userName);//remove and hold value in songVerse

System.out.println(songVerse);//print value

}

}

Output:

please find the attachment.

Explanation:

Description of the code:

  • In the above code, a two-string variable "userName and songVerse" is declared, in which we input value by creating scanner class object that is "obxc".
  • In the next step, two inbuilt string methods "substring and replace" are used, in which the first method is used to remove the first character from the name, and the second method replaces the value from the second input.
  • At the last step, the print methods have used that prints its replaced value.

Do you know the better answer?

Latest questions in Computers & Technology

how much longer is a 1-inch button than a 3/8-inch button

Questioned by shounteria @ in Mathematics viewed by 75 persons

View 0 answers

which style of vase had a black background?

Questioned by trent446 @ in Art viewed by 63 persons

View 0 answers

sex

Questioned by ethan283 @ in General viewed by 80 persons

View 0 answers

what happens during a land breeze?

Questioned by destiny56 @ in Biology viewed by 121 persons

View 0 answers

themes of mum dad and me by james berry

Questioned by xishauna @ in English viewed by 113 persons

View 0 answers

wtite an informative essay on a greek mythical character

Questioned by kadin421 @ in English viewed by 200 persons

hercules
View 0 answers

who understands me but me interpret the tone

Questioned by casarruibas @ in English viewed by 149 persons

reread lines 29-38 of who understands me but me interpret the tone and support your answer with textual evidence
View 0 answers

Most viewed questions in Computers & Technology


3.4 6 t shirt shop codehs answers

Questioned by maham237 @ in Computers & Technology viewed by 3747 persons


security infrastructure design document

Questioned by administrator @ in Computers & Technology viewed by 3028 persons



real world examples of problems whose solutions do scale well

Questioned by maham237 @ in Computers & Technology viewed by 2965 persons


codehs python answers

Questioned by maham237 @ in Computers & Technology viewed by 2528 persons


codehs python answer key

Questioned by maham237 @ in Computers & Technology viewed by 1972 persons



edhesive assignment 3: chatbot 1

Questioned by maham237 @ in Computers & Technology viewed by 1192 persons


open the excel workbook revenue xls from the default directory

Questioned by maham237 @ in Computers & Technology viewed by 951 persons


banana fee fi fo fana song

Questioned by maham237 @ in Computers & Technology viewed by 882 persons



phone number breakdown zybooks

Questioned by maham237 @ in Computers & Technology viewed by 624 persons



assign negativecntr with the number of negative values in the linked list.

Questioned by maham237 @ in Computers & Technology viewed by 586 persons


in cell j4 calculate the actual increase

Questioned by maham237 @ in Computers & Technology viewed by 546 persons


kay fox and the magic sword cheats

Questioned by administrator @ in Computers & Technology viewed by 520 persons