Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hello, please help me write this code in Java: In this question, you are asked to develop a new social media application for sharing pictures.
Hello, please help me write this code in Java:
In this question, you are asked to develop a new social media application for sharing pictures. This platform allows uploading a picture in different formats, including a single post and also stories that extend the post for a longer duration. For building this application you can use the following classes in your design: A Picture object represents a single image whereas videos are Picture arrays that copy the same image, and allow displaying the same Picture for a longer duration of time. In your application you will implement an interface to interact with the users and allow them to upload the specified image in their computer, and later inquire about the length of the video in seconds. If the requested length is larger than or equal to 6 seconds, the application should compress the video by dropping one picture from every 3 pictures in the array. The compressed array should then be returned to the application for uploading. An example usage of the application is given below. Please pick desired operation: (1) Post image (2) Upload image as story (3) Return. Please pass the path to the file storing your picture. YUsers/dataman/Desktop/cat.jpg Picture uploaded. Please pick desired operation: (1) Post image (2) Upload image as story (3) Return. Please pass the path to the file storing your picture. /Users/dataman/Desktop/cat.jpg Your image size is: 237908 bytes. Please enter how many seconds would you like this picture to be displayed on your story. Min 1, max 10 seco Your video is longer than acceptable size for uploading. It will be compressed before uploading. Video uploaded. Returning to main menu. Please pick desired operation: (1) Post image (2) Upload image as story (3) Return. Returning to main menu. Please use the provided code for uploading images into byte arrays. String filepath = "/Users/dataman/Desktop/cat.jpg"; RandomAccessFile f= new RandomAccessFile(filepath, " r"); byte[] image = new byte[(int) f. length()]; f.read(image); f. close (); Note that your application should implement the two classes, and a main method in the Video class for executing the application. Uploading content can be omitted via displaying messages on the terminal. Please handle any relevant exceptions accordingly. Please include as many justification as possible in your answers, and detailed comments, for aiding the grading process and in case to be able to allocate partial gradingStep 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