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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Program this

Create a Post 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 0 to represent midnight, 1 for
1am, ... through 23 for 11pm.
The Post class must provide a constructor that takes all four values, 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 PostMonitor Class
Create a new class called PostMonitor and fill in the comment details. This class represents your "monitor" that tracks information about posts. The
PostMonitor class has 3 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.
(Again, no setter methods.)
Transcribed Image Text:Create a Post 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 0 to represent midnight, 1 for 1am, ... through 23 for 11pm. The Post class must provide a constructor that takes all four values, 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 PostMonitor Class Create a new class called PostMonitor and fill in the comment details. This class represents your "monitor" that tracks information about posts. The PostMonitor class has 3 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. (Again, no setter methods.)
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Software Development
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.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education