Question: Task: Sentence Manipulation Using an Extended Class and FormattedOutputObjective:This assignment focuses on working with Java classes, inheritance, string manipulation, and formatted output.Requirements: 1 . Base

Task: Sentence Manipulation Using an Extended Class and FormattedOutputObjective:This assignment focuses on working with Java classes, inheritance, string manipulation, and formatted output.Requirements:1. Base Class: Sentencea. Create a base class Sentence with the following:i. A private String field to store the sentence. ii. A constructor to initialize the sentence. ili. A getSentence) method to retrieve the sentence. iv. A setSentence(String sentence) method to modify thesentence.V. A method wordCount) that returns the number of words in the sentence.2. Extended Class: AdvancedSentencea. Extend the Sentence class to create AdvancedSentence with additional functionality:i. A method reverseSentence) that returns the sentence with its words in reverse order.Example: "Java is fun" "fun is Java".ii. A method toUpperCaseSentence) that returns thesentence in uppercase.iii. A method formattedDisplay) that prints the sentence, word count, and reversed sentence using formatted output (e.g., printf).3. Main Classa. In the main) method:i. Prompt the user to input a sentence and create an AdvancedSentence object.ii. Display the following information using the formattedDisplay() method:1. Original sentence.2. Word count.3. Reversed sentence.iii. Convert the sentence to uppercase usingtoUpperCaseSentence) and display it.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!