Create a new class called Post and fill in the comment details. This class represents a single "post" or "message" on a message sharing service like Twitter or Facebook. For this lab assignment, a Post is defined primarily by its attributes. For each of the attributes below, you must: 1. Declare a field with the given name and type. 2. Define a getter method (accessor) for the field. Note that the attributes of a Post) are read-only and no setters are provided. Once the post is created, the values specified in the constructor become the "permanent" values for the fields. In this particular model, you can't go back and "edit" posts after they have been made by calling setter methods. This is a design choice for this model, but when creating your own classes on your own projects, you always have the freedom to decide whether or not a setter (or even a getter) is appropriate or not. Attribute Type Description name message day hour] string The name of the post's author/creator. string The message or "body" of the post. This is the post's main content. int The day of the week when the post was published, in the form of an integer in the range 0-6. We will use O to represent Sunday, 1 for Monday, ... through 6 for Saturday. int The hour of the day when the post was published, in the form of an integer in the range 0-23. We will use O to represent midnight, 1 for 1am, ... through 23 for 11pm. The Post class must constructo that takes all four the name, message, day, and hour, in that order. It should initialize all the fields with the corresponding parameter values. For this llab, you can assume that only valid values for the day and hour will be provided (that is, you can assume all values are in-range, and the two strings are non-null). Note on testing: since Post provides only getters, setters, and a simple constructor, there is no need to create a Post Test class for unit tests. This class serves only as data, and will be thoroughly used in testing your next class.
Create a new class called Post and fill in the comment details. This class represents a single "post" or "message" on a message sharing service like Twitter or Facebook. For this lab assignment, a Post is defined primarily by its attributes. For each of the attributes below, you must: 1. Declare a field with the given name and type. 2. Define a getter method (accessor) for the field. Note that the attributes of a Post) are read-only and no setters are provided. Once the post is created, the values specified in the constructor become the "permanent" values for the fields. In this particular model, you can't go back and "edit" posts after they have been made by calling setter methods. This is a design choice for this model, but when creating your own classes on your own projects, you always have the freedom to decide whether or not a setter (or even a getter) is appropriate or not. Attribute Type Description name message day hour] string The name of the post's author/creator. string The message or "body" of the post. This is the post's main content. int The day of the week when the post was published, in the form of an integer in the range 0-6. We will use O to represent Sunday, 1 for Monday, ... through 6 for Saturday. int The hour of the day when the post was published, in the form of an integer in the range 0-23. We will use O to represent midnight, 1 for 1am, ... through 23 for 11pm. The Post class must constructo that takes all four the name, message, day, and hour, in that order. It should initialize all the fields with the corresponding parameter values. For this llab, you can assume that only valid values for the day and hour will be provided (that is, you can assume all values are in-range, and the two strings are non-null). Note on testing: since Post provides only getters, setters, and a simple constructor, there is no need to create a Post Test class for unit tests. This class serves only as data, and will be thoroughly used in testing your next class.
Chapter11: Advanced Inheritance Concepts
Section: Chapter Questions
Problem 3PE
Related questions
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,