Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need this ASAP thats the code if needed public class TestDisplayPanel { public static void main(String[] args) { // Create instance with default constructor
I need this ASAP
thats the code if needed
public class TestDisplayPanel { public static void main(String[] args) { // Create instance with default constructor DisplayPanel p1 = new DisplayPanel(); // Test setters p1.setManufacturer("Sony"); p1.setWidth(23.53); p1.setHeight(13.24); p1.setHorizontalPixels(1920); p1.setVerticalPixels(1080); // Test toString() method System.out.println("toString() - "); System.out.println( p1 ); System.out.println(); // Create instance with overloaded argument constructor DisplayPanel p2 = new DisplayPanel("Lenovo", 21, 12.5, 2560, 1440); // Test Getters System.out.println( "getManufacturer() - " + p2.getManufacturer() ); System.out.println( "getWidth() - " + p2.getWidth() ); System.out.println( "getHeight() - " + p2.getHeight() ); System.out.println( "getHorizontalPixels() - " + p2.getHorizontalPixels() ); System.out.println( "getVerticalPixels() - " + p2.getVerticalPixels() ); System.out.println(); // Test diagonalSize() method System.out.println( "diagonalSize() - " + p2.diagonalSize() ); System.out.println(); // Test pixelsPerInch() method System.out.println( "pixelsPerInch() - " + p2.pixelsPerInch() ); System.out.println(); // Test totalPixels() method System.out.println( "totalPixels() - " + p2.totalPixels() ); System.out.println(); // Test toString() method with 2nd instance System.out.println("toString() - "); System.out.println( p2 ); System.out.println(); } }
Using the UML diagram provided at the bottom of this post as a guide, write this class. When you are done you will submit your class to Blackboard. UML Rubric (80 points) - 10 points - Class is named properly, imports libraries as appropriate, follows standard java conventions for naming variables, methods, and organizing classes. - 10 points - Class correctly implements the five fields indicated in the UML diagram - 5 points - Class correctly implements the no-arg constructor indicated in the UML diagram - 5 points - Class correctly implements the argument constructor indicated in the UML diagram - 10 points - Class correctly implements the mutator methods (setters) indicated in the UML diagram - 10 points- Class correct implements the accessor methods (getters) indicated in the UML diagram - 5 points - Class correctly implements the diagonalSize() method indicated in the UML diagram. This value is the diagonal length of the display panel in inches and is the hypotenuse of the right triangle formed by the width and height values. (1 point for proper method header, 4 points for the method's implementation) - 10 points - Class correctly implements the pixelsPerInch() method indicated in the UML diagram. Information on how to calculate this value can be found here. This calculation requires that you calculate the diagonal length of the panel which is the hypotenuse of the right triangle formed by the horizontalPixels and verticalPixels values. PPI is calculated by dividing the diagonal lenght in pixels by the diagonal length in inches. (1 point for proper method header, 9 points for the method's implementation) - 5 points - Class correctly implements the totalPixels() method indicated in the UML diagram. (1 point for proper method header, 4 points for the method's implementation) - 10 points - Class correctly implements the toString() method indicated in the UML diagram. (1 point for proper method header, 9 points for the method's implementation)
Step 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