Question: In this exam we will write an app that displays on the screen the flag of Palestine and the Alquds University logo and Abu



In this exam we will write an app that displays on the screen the flag of Palestine and the Alquds University logo and Abu Dies campus logo. Write an interface called Drawable. The interface represent objects that could be drawn. The interface will contain the following abstract method: public abstract void draw (int x, int y, int width, int height, Graphics g) - the method will accept as parameters the dimensions of the drawing surface - the coordinates of the upper left corner, its width and height (the drawing will always be done within a rectangular area), and a Graphics object which represents the graphical context of the element on which it is drawn. The method will draw the object within the given rectangle dimensions. Write two classes that implement the above Drawable interface: The PlaestineFlage class will represent Palestine flag. The class will implement the abstract method and draw within the dimensions of the given rectangle the flag of Palestine. The AlqudsLogo class will represent Alquds University Logo. The class will implement the abstract method and draw within the dimensions of the given rectangle the logo of Alquds Unversity. The Abudies Logo class will represent Abu Dies campus Logo. The class will implement the abstract method and add the image of Abu Dies campus logo within the dimensions of the given rectangle. For your convenience, attached photos of flag and logo. AL-QUDS UNIVERSITY AL-QUDS UNIVERSITY The following is an image the represents Abu Dies Campus logo The flag and the university logo should be drawn, but Abu dies Campus logo is an image. Write a class called Flags Panel that inherits from the JPanel class. The class will implement an app that will display on-screen flags and logos The class will contain the attribute: Drawable flags - An array of Drawable objects that will contain objects of Palestine flag and Alquds University logos. The class will contain one constructor whose signature is: public Flags Panel (int rows, int cols) - The constructor will receive as parameters several rows and several columns and initialize the array of flags in these sizes. The constructor will randomly create rows X cols objects of flag and logo and populate the array with them. For example, if the number of rows is 2 and the number of columns is 3, the constructor will create 6 objects. The type of objects will be determined randomly. For example, 3 Palestine flags, 2 Alquds logo and 1 for Abudies logo image. How the app works - the panel will divide the screen into a table of rows and cols columns (where rows and cols are the dimensions of the two-dimensional array obtained in the constructor). Each cell in the table will have the appropriate flag drawn from the array. Note that even when changing the screen dimensions the screen still needs to be divided into the same number of cells, with the same flag or logo (i.e., the raffle of flags and logos is done only once, in the constructor). Submitting instructions: 1. You must submit the classes Drawable.java, PalestineFlag.java, AlqudsLogo.java, AbudiesLogo.java, Flags Panel.java only. Do not add any other classes. 2. Your code should be bugless and executable. 3. Submit your code in a zip folder named takehomexam.zip or takehomexam.rar. 4. Submit your code on 5/5/2022 before 10:00 pm. Good luck.
Step by Step Solution
3.45 Rating (161 Votes )
There are 3 Steps involved in it
Drawablejava java import javaawtGraphics public interface Drawable void drawint x int y int width int height Graphics g PalestineFlagjava java import ... View full answer
Get step-by-step solutions from verified subject matter experts
