Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab 9 Part I: Write java program that design MyPost class from Social Media system to help users manage their posts. My Post - likes.No:

image text in transcribed
image text in transcribed
Lab 9 Part I: Write java program that design MyPost class from Social Media system to help users manage their posts. My Post - likes.No: int + pestDese: String post Year: int MyPost MyPest (postDese. postYear) addlikel): void set Post(String]:void . [1 point likesNo is a private field that counts the number of likes on this post. [0.5 point postDesc is the post full words. (0.5 point post Year is the year number of post-date. 11 point) likesNo is read only field. 13 points) Two constructors. . [1 point addLike () method increases the number of likes by one . 11 point set Post method edits the post text A) [11 points 1. Write java code for MyPost class. 2. 12 points Add a class variable to calculate the number of all posts in the system 3. [1 point) Add numberOfPosts() method to print the total number of posts in the system. B) (4 points) Write a test class that: Creates two MyPost objects and fills data from the user. Write printPost(MyPost, MyPost) method that takes two My Post objects and print on screen post description of the post with highest number of likes. print on screen post description of the oldest post (compare post Year of the two objects). Part II Find the output class A{ private int x=7; } class Test { public static void main(String [])){ A al=new A(); System.out.println(al.toString(); } } b. class A private int x=7; AOX System.out.println(x++); } } class B extends A{ BO{System.out.println("welcome"); } } class Test { public static void main(String [] { Bal=new BO; } }

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

Database Design And Implementation

Authors: Shouhong Wang, Hai Wang

1st Edition

1612330150, 978-1612330150

More Books

Students also viewed these Databases questions

Question

What are the different categories of financial instruments?

Answered: 1 week ago

Question

Describe the nature of negative messages.

Answered: 1 week ago