Question: Lab 3 Facebook Banner (Abstract/Interfaces) Problems 1. [CODE] [100pts] Lets face it, your Facebook banner probably needs a little bit of a facelift. Youre in

Lab 3 Facebook Banner (Abstract/Interfaces)

Problems 1. [CODE] [100pts] Lets face it, your Facebook banner probably needs a little bit of a facelift. Youre in luck because today you will write a Java application which generates for you both a psychedelic and personalized (custom) Facebook banner! Youre project will use principles from abstract classes/methods and interfaces. You will also get a taste of 2D graphics (drawing images with ovals, rectangles, text and images). Your lab will involve 4 separate Java classes: a) CS125_Lab3_Client.java You will only make small changes to this file to reflect your name(s) in the header and print statements. Examine the main() method, as well as the two other methods called from main(). This client class will generate two banners using the PersonalizedFbBanner class which you will create. The CreatePsychedelicBanner() method creates a very colorful banner with your image in the center as seen in Figure 1. The CreateCustomBanner() creates a banner via a method which you will specifically write to your liking, as seen in Figure 2. Your program expects you to have an image file called myPic.jpg inside of your project folder in Windows/MacOS. If you created your project as we normally do, you can place this file in your Java Project folder by dragging it from your desktop/window into the Project folder in Eclipse (where you normally drag the templates to) and clicking Copy To (NOTE: Do NOT drag it into the src folder like you do the templates, but rather, one directory up). b) FbBanner.java YOU WILL NOT CHANGE THIS FILE AT ALL (do not even change the name). This class is the abstract Facebook banner super class. Please take a good look through it as it contains a lot of useful methods and instance variables that you can take advantage of. For instance: getWidth() will return an integer with the width of a Facebook banner getHeight() will return an integer with the height of a Facebook banner writeImageToFile(String fileName) will create an image of your banner as fileName.jpg on your computer rotateDrawingAngle(double degrees) will rotate the angle at which things are drawn by your Graphics2D draw commands (explained later) CS 125 Grissom Page 2 of 3 setRotationAngleToDefault() will reset the drawing angle to normal so your draw commands draw straight figures and text drawCenteredPicture(String fileNameWithExtension, int percentSize) draws the picture found at fileNameWithExtension (e.g., myPic.jpg) at the size dictated by percentSize in the middle of your banner g2d is a member variable of type Graphics2D (a Java library class). This member variable is essentially the graphics engine for your banner It also contains a method called drawCustomizedDecoration(), which you will override in another class. c) RandomDrawMethods.java YOU WILL NOT CHANGE THIS FILE AT ALL (do not even change the name). Note that this is an interface, and thus, does not contain any real code. Rather, it contains three method headers, as well as a static member variable full of common colors (Color is another Java library class). These methods will need to be overridden in another class; however, this class contains in-depth details about how these classes should be used and explains how to use the Graphics2D g2d instance variable to draw shapes and text. d) PersonalizedFbBanner.java This is where your new code will go. This class must extend FbBanner and implement RandomDrawMethods (yes, a single class can extend AND implement in a single header). Your class must provide implementations for each of the methods in RandomDrawMethods; again, see RandomDrawMethods.java for detailed method descriptions and hints of how to do this. Your class must also override the abstract method drawCustomizedDecoration(), found in FbBanner. This should be the last thing you do, after youve implemented RandomDrawMethods and have gained a little experience with the Graphics2D engine. Your goal with this method is to create a custom banner that you enjoy. This doesnt need to be too incredibly complex. In my custom banner, seen in Figure 2, I simply use a nested FOR loop and draw ovals with Dr. Dans alma maters (the Cincinnati Bearcats) colors being alternated back and forth.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!