Question: 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:

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
Get step-by-step solutions from verified subject matter experts
