
Here is the completed code for this problem. Assuming this is based on Java swing (2D graphics). Comments are included, go through it, learn how things work and let me know if you have any doubts or if you need anything to change. If you are satisfied with the solution, please rate the answer. If not, PLEASE let me know before you rate, I’ll help you fix whatever issues. Thanks
// DrawShape.java
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.JFrame;
public class DrawShape extends JFrame {
// constructor to initialize the GUI
public DrawShape() {
// setting up and displaying the window
setDefaultCloseOperation(EXIT_ON_CLOSE);
setSize(500, 500);
setVisible(true);
}
@Override
public void paint(Graphics g) {
super.paint(g);
// creating a Graphics2D object from g
Graphics2D g2d = (Graphics2D) g;
// creating a gradient color which is a mix of yellow and blue ish color
GradientPaint fill = new GradientPaint(0, 100,
new Color(255, 255, 100), 0, 500, new Color(135, 206, 235));
// using this color as fill color
g2d.setPaint(fill);
// filling a rounded rectangle at 100,100 with width=300, height=300,
// arc width=80 and arc height=100
g2d.fillRoundRect(100, 100, 300, 300, 80, 100);
// using a stroke width of 5
g2d.setStroke(new BasicStroke(5));
// using some brownish color as stroke color
g2d.setColor(new Color(210, 105, 30));
// drawing the rounded rect with same coordinates to draw the outline
// only
g2d.drawRoundRect(100, 100, 300, 300, 80, 100);
// using white as fill color
g2d.setPaint(Color.WHITE);
// filling inner rounded rectangle at the top
g2d.fillRoundRect(180, 150, 140, 70, 80, 100);
// filling inner rounded rectangle at the bottom
g2d.fillRoundRect(180, 275, 140, 70, 80, 100);
// using black stroke color, drawing an outline for these rounded
// rectangles
g2d.setColor(Color.BLACK);
g2d.drawRoundRect(180, 150, 140, 70, 80, 100);
g2d.drawRoundRect(180, 275, 140, 70, 80, 100);
}
public static void main(String[] args) {
// initializing the GUI
new DrawShape();
}
}
/*OUTPUT*/

Please write in Java Language Write an abstract class Shape with an attribute for the name of the shape (you'll use this later to identify a particular shape). Include a constructor to set the name of the shape and an abstract calculateArea method that has no parameters and returns the area of the shape. Optionally, include a constructor that returns the name of the shape and its area (by calling the calculateArea method). Write a Rectangle class that inherits from...
What is Java? What language did Java come from? Who created Java?
Language: Java / Python Topic: Invoices
Use Language Evaluation Criteria to evaluate Java programming language and C++ programming language. Language Evaluation Criteria: Readability, writeability, reliability & cost •Readability: the ease with which programs can be read and understood •Writability: the ease with which a language can be used to create programs •Reliability: conformance to specifications (i.e., performs to its specifications) •Cost: the ultimate total cost
This is in java language. Please use simple java programming
language.
Each of the parts a. through c. below is preceded by a comment indicating what the code do. There is a least one problem with each section of code and it fails to do what was inte Show how to modify or rewrite the code so that it works as intended. Assume that all varia used have already been declared. а. // INTENT : given an array arr of...
JavaScript is not Java but complements it: True False Which of the following is the language of the Web : XML HTML JavaScript None of the above CSS is Creative Style Sheets Creative Stylish Sheets Cascading Style Sheets Cascading Styling Sheets Which of the following is not a client side language? JavaScript HTML CSS Java
Language is JAVA.
Clarification for the Shape class (highlighted):
The following requirements specify what fields you are expected
to implement in your Shape class;
- A private String color that specifies the color of the
shape
- A private boolean filled that specifies whether the shape is
filled
- A private date (java.util.date) field dateCreated that
specifies the date the shape was created Your Shape class will
provide the following constructors;
- A two-arg constructor that creates a shape
with...
Java discussion question What is Primitive Casting in Java programming language? Explanation MUST be at LEAST a paragraph long. Don't forget to post Programming Examples.
Define all the points, lines, and circles on the shown shape and in the APT language format. Given R1=R2=0.5 mm Define all points, lines, and Circles in this shape. Given Ri= R2² 1.5mm. 5,5+
Java is an object-oriented programming language that enables us to define classes and to instantiate them into objects. These objects then call each other’s methods to implement the behavior of the application. The Unified Modeling Language (UML) is an object-oriented visual notation to document the design of object-oriented classes. For this discussion, you will practice designing a Java class called Course, drawing a UML class diagram for the Course class, and then implementing the Course class in Java code. Review...