Question
help i need to Create a class named Poem that contains fields for the name of the poem and the number of lines in it.
help i need to Create a class named Poem that contains fields for the name of the poem and the number of lines in it. Include a constructor that requires values for both fields. Also include get methods to retrieve field values. Create three subclasses: Couplet, Limerick, and Haiku. The constructor for each subclass requires only a title; the lines field is set using a constant value. A couplet has two lines, a limerick has five lines, and a haiku has three lines. Create an application that demonstrates usage of an object of each type. Save the files as Poem.java, Couplet.java, Limerick.java, Haiku.java, and DemoPoems.java here is my program it gives me an error when i run the DemoPoems.java
gs Tools Window Help ame public class Poem private String poemName; private int lines; public Poem(String poemName, int lines) this.poemNamepoemName; this.lines = lines; public String getPoemName() return poemName; public int getLines() return lines
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