Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

program calledTeenthat takes a sentence and returns a new sentence based on how a teenager might say that. The method that creates the new string

program calledTeenthat takes a sentence and returns a new sentence based on how a teenager might say that. The method that creates the new string should be calledteenTalkand should have the signature shown in the starter code.

The way to do that is to put the word"like"in between each of the words in the original sentence.

For example,teenTalk("That is so funny!")would return"That like is like so like funny!".

Sample output:

Sonequa Martin-Green is in grade 10 and wants to send this text: Enter the text message being sent: Hello world how are you doing? 

The teen talk text would be:

Hello like world like how like are like you like doing? 

public class Teen {   private String firstName;   private String lastName;   private int grade;   private Boolean textMessages;   // Constructor to make a teen with a first and last name, grade in school,   // and whether they text message others and need to write texts to others.     // This defines the state of the teen.   public Teen(String theFirstName, String theLastName, int theGrade, Boolean theTextMessages)   {     firstName = theFirstName;     lastName = theLastName;     grade = theGrade;     textMessages = theTextMessages;   }     // toString method to print out the state of teen object   public String toString()   {     return firstName + " " + lastName + " is in grade " + grade + " and wants to send this text:";   }     // Create this method so that it changes the text message   // and places the word "like" in place of each space   // in the message.   public String teenTalk(String text)   {       }   } 

public class TeenTester {   public static void main(String[] args)   {     // Create a new Teen object and print it out; see the Teen class file     // to see how the constructor and toString method work.     Teen myFriend = new Teen("Sonequa", "Martin-Green", 10, true);     System.out.println(myFriend.toString());         // Ask the user to input a text message         //Call teenTalk method to translate the message to teen talk   } } 

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

What are aquatic animal?

Answered: 1 week ago

Question

Animals that eat plant is called?

Answered: 1 week ago

Question

The world largest animal?

Answered: 1 week ago

Question

Pet animal example two?

Answered: 1 week ago