Explanation of Solution
Given: The class names such as Circle, Square, Triangle, Person, and Canvas.
To find:Â The possible way to create another circle and then a square.
Solution:
Start BlueJ and open a new project named figures.
A new window will appear on the screen in which each rectangular block will represent a class.
In order to create an object of Circle class, it is necessary for the user to right click on the Circle class and then click on the new Circle() from the pop-up menu. The user can provide a specific name of the instance and then click ok button.
A new red rectangle will appear at the bottom of the BlueJ screen labeled with the name of the instance provided by the user.
In order to create an object of Square class, it is necessary for the user to right click on the Square class and then click on the new Square() from the pop-up menu. The user will be prompt to provide a specific name of the instance and then click ok button.
Another red rectangle will appear at the bottom of the BlueJ screen labeled with the name of the instance provided by the user.
Want to see more full solutions like this?
Chapter 1 Solutions
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
- You roll a number cube numbered from 1 to 6. You then spin a spinner with 3 sections each with a different color. The spinner has the colors yellow, pink, and green. P(not green and not 2).arrow_forwardCan you make the triangle that is on top a different color other then red pleasearrow_forward1arrow_forward
- Write code to draw the following picture.arrow_forwardCreate the design for determining if a point is inside, on, or outside of the rectangle. Drawing out the rectangle and labeling the coordinates of all points will help you to visualize the problem. Once the design has been completed, write a program that prompts the user for the x and y coordinates for the lower left hand corner of a rectangle as well as the height and the width of the rectangle. After that, you will need to get the coordinates for the point from the user as well. Once all inputs have been entered by the user, determine if the point is inside the rectangle, on the rectangle, or outside the rectangle. If the point is inside the rectangle, print "inside the rectangle". If the point is on the rectangle, print "on the rectangle". If the point is outside of the rectangle, print "outside the rectangle". Example output: Enter the x coordinate of the lower left hand corner of the rectangle: 1 Enter the y coordinate of the lower left hand corner of the rectangle: 1 Enter the…arrow_forward3. Randomly generate a number in range [1, 12]. Map this number to a season: if the number is 3, 4, or 5, map it to “Spring", if the number is 6, 7, or 8, map it to "Summer", if the number is 9, 10, or 11, map it to "Fall", and if the number 12, 1, or 2, map it to "Winter". Display season namearrow_forward
- Q3: Lecture Hall Dan holds his CSC108 lectures in a rectangular N X M lecture hall. In other words, this lecture hall has N rows of seats, each of them containing exactly M seats. Here's my attempt at drawing this layout when N = 3 and M = 5: Dan Off 00 lecture hall layout with 3 rows and 5 seats per row The rows are numbered from 1 to N starting from the front row. Similarly, the columns are numbered from 1 to M starting from the leftmost column. We write (r, c) to denote the c-th seat in the r-th row. When Dan walks into the lecture hall this morning, some of the seats are already taken (this is the initial layout of the lecture hall). After that, the students come in one group at a time. From experience, Dan knows that when a group of K students enter the lecture hall, they look for K consecutive empty seats. That is, they try to find an empty seat (r, c) such that for all integers i in [0, K-1], the seat (r, c + 1) exists and is empty. If they can't find K consecutive empty seats,…arrow_forward2. drawShape(Turtle, sides, length): Draws the polygon based on the user input of # of sides and lenght of the side.arrow_forwardNonearrow_forward
- Please do not give solution in image format thanku Flappy Bird We have a red dot flapping through a maze of “pipes” (green vertical lines). Press the button and the dot goes up, release the button and the dot goes down. You need to also keep track of the score, which will be a decimal value of up to at least 999, shown on the hex displays of the board. The project will be done with Verilog and FPGA Describe the project from a user standpoint: what it does, how the user will interact with it (be specific; think about what I/O they will use to move left or right), etc. Include a top-level block diagram. This needs to be detailed enough that we can understand how the different blocks of the system interact, but does not have to be super complex.arrow_forward+)Do code). """You are given an n x n 2D mat representing an image. Rotate the image by 90 degrees (clockwise). Follow up:Could you do this in-place?""" # clockwise rotate# first reverse up to down, then swap the symmetry# 1 2 3 7 8 9 7 4 1# 4 5 6 => 4 5 6 => 8 5 2# 7 8 9 1 2 3 9 6 3 def rotate(mat): if not mat: return mat mat.reverse() for i in range(len(mat)): for j in range(i): mat[i][j], mat[j][i] = mat[j][i], mat[i][j] return mat if __name__ == "__main__": mat = [[1, 2, 3], [4, 5, 6], [7, 8, 9]].arrow_forwardWrite the code to draw a polygon with points at (10, 10), (15, 30), (140, 10), and (10, 100). Fill the shape with red.arrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTNp Ms Office 365/Excel 2016 I NtermedComputer ScienceISBN:9781337508841Author:CareyPublisher:Cengage