In this exam we will write an app that displays on the screen the flag of...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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. 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.
Expert Answer:
Answer rating: 100% (QA)
Drawablejava java import javaawtGraphics public interface Drawable void drawint x int y int width int height Graphics g PalestineFlagjava java import ... View the full answer
Related Book For
Java How To Program Late Objects Version
ISBN: 9780136123712
8th Edition
Authors: Paul Deitel, Deitel & Associates
Posted Date:
Students also viewed these programming questions
-
CANMNMM January of this year. (a) Each item will be held in a record. Describe all the data structures that must refer to these records to implement the required functionality. Describe all the...
-
"internet radios" for streaming audio, and personal video recorders and players. Describe design and evaluation processes that could be used by a start-up company to improve the usability of such...
-
Histogram. Suppose that the standard input stream is a sequence of double values. Write a program that takes an integer n and two real numbers lo and hi as command-line arguments and uses StdDraw to...
-
Vertical analysis percentages from Waubon Corp.'s income statement are listed here: ___________________________2018...................2017...............2016 Net...
-
The MJK Manufacturing Company must produce two products in sufficient quantity to meet contracted sales in each of the next three months. The two products share the same production facilities, and...
-
What do you like best about working at this company?
-
BusServ.com Corporation provides business-to-business services on the Internet. Data concerning the most recent year appear below: Sales . . . . . . . . . . . . . . . . . . . . . . . $8,000,000 Net...
-
The trial balance for Lindor Corporation, a manufacturing company, for the year ended December 31, 2024, included the following accounts: Account Title Sales revenue Cost of goods sold Selling and...
-
Allen Blay owns 100% of the stock in AB Corporation, organized ten years ago in California. AB operates a foreign branch in Country A. In the current year, AB reports $500,000 of taxable income from...
-
What are promissory notes and how do they differ from commercial papers or letters of credit?
-
What is a patient origin study, and how can it inform strategic thinking?
-
Jason, a project manager, is working with his team to estimate the total cost of developing a web-based CRM system. After reviewing the planned scope of work with Jason, his sponsor suggests that...
-
What are some of the exchanges that occur in the healthcare market?
-
Identify two projects your company or school will be performing in the future. Which one do you think will have a more detailed WBS? Why?
-
When a company buys cotton in Egypt, has tops sewn from it in Sri Lanka according to designs made in Italy, and then offers the garments for sale in the United States, this form of international...
-
Assume that George Mason Medical Center had investments in a Building Replacement Fund with the following balances as of 9/18/19 listed by category. The Investment Committee of the Board has approved...
-
Show that the block upper triangular matrix A in Example 5 is invertible if and only if both A 11 and A 22 are invertible. Data from in Example 5 EXAMPLE 5 A matrix of the form A = [ A11 A12 0 A22 is...
-
Provide the inorder, preorder and postorder traversals of the binary search tree of Fig. 21.18. Fig. 21.18 18 11 19 28 40 49 71 32 44 69 72 83 97 92 99
-
Show what happens when the following code is entered in JShell: /* incomplete multi-line comment System.out.println(Welcome to Java Programming!) /* complete multi-line comment */
-
Fill in the blanks in each of the following statements: a. A self- class is used to form dynamic data structures that can grow and shrink at execution time. b. A(n) is a constrained version of a...
-
Using all the tips presented in this chapter, write your rsum. Aim it at a full-time job, part-time position, or internship that you researched online. Attach the job listing to your rsum. Also...
-
What is the imperative mood, and why is it preferred over the indicative mood?
-
Can workers today be successful if their writing is and remains poor? What could be the career fallout for someone who is unwilling or unable to train to become a better communicator?
Study smarter with the SolutionInn App