Add a second sun to the picture. To do this, pay attention to the field definitions close to the top of the class. You will find this code:
You need to add a line here for the second sun. For example:
Then write the appropriate code in two different places for creating the second sun and making it visible when the picture is drawn.
Want to see the full answer?
Check out a sample textbook solutionChapter 1 Solutions
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
Additional Engineering Textbook Solutions
Computer Science: An Overview (12th Edition)
Starting Out with Java: Early Objects (6th Edition)
Computer Systems: A Programmer's Perspective (3rd Edition)
Database Concepts (7th Edition)
Starting Out with C++: Early Objects (9th Edition)
Web Development and Design Foundations with HTML5 (9th Edition) (What's New in Computer Science)
- Without adding any method or function to the classes shown below. Find out the coverage of the canvas that encloses all the circles that are generated by the program. Circle 0: center = (x = 35.57, y = -36.60), radius = 92.27 Circle 1: center = (x = -18.04, y = -5.67), radius = 98.76 Circle 2: center = (x = -10.82, y = -45.88), radius = 111.03 Circle 3: center = (x = 48.97, y = 1.55), radius = 106.70 Circle 4: center = (x = -12.89, y = 4.64), radius = 86.49 Circle 5: center = (x = 19.07, y = 17.01), radius = 145.67 Circle 6: center = (x = 15.98, y = 12.89), radius = 139.18 Circle 7: center = (x = -3.61, y = -9.79), radius = 85.05 Circle 8: center = (x = -8.76, y = 44.85), radius = 98.76 Circle 9: center = (x = -39.69, y = -28.35), radius = 127.63 Circle 1 intersecting with Circle 4, 5, 6 Circle 3 intersecting with Circle 5 Circle 4 intersecting with Circle 5, 6 Circle 5 intersecting with Circle 6, 7, 8 Circle 6 intersecting with Circle 7 Circle 7 intersecting with Circle 9 Bye... Note…arrow_forwardcan you please help me with the last part of this code because I don't understand this; part of the code is below and the other part of the code is in the photo. question: In the LightsOutPuzzle class, write a method copy(self) that returns a new LightsOutPuzzle object initialized with a deep copy of the current board. Changes made to the original puzzle should not be reflected in the copy, and vice versa. >>> p = create_puzzle(3, 3)>>> p2 = p.copy()>>> p.get_board() == p2.get_board()True >>> p = create_puzzle(3, 3)>>> p2 = p.copy()>>> p.perform_move(1, 1)>>> p.get_board() == p2.get_board()False In the LightsOutPuzzle class, write a method successors(self) that yields all successors of the puzzle as (move, new-puzzle) tuples, where moves themselves are (row, column) tuples. The second element of each successor should be a new LightsOutPuzzle object whose board is the result of applying the corresponding move to the current…arrow_forwarda. Carly's Catering provides meals for parties and special events. In Chapters 3 and 4, you created an Event class for the company. Now, make the following changes to the class: Currently, the class contains a field that holds the price for an Event. Now add another field that holds the price per guest, and add a public method to return its value. Currently, the class contains a constant for the price per guest. Replace that field with two fields—a lower price per guest that is $32, and a higher price per guest that is $35. Add a new method named isLargeEvent() that returns true if the number of guests is 50 or greater and otherwise returns false. Modify the method that sets the number of guests so that a large Event (more than 50 guests) uses the lower price per guest to set the new pricePerGuest field and calculate the total Event price. A small Event uses the higher price. Save the file as Event.java. b. In Chapter 4, you modified the EventDemo class to demonstrate two Event…arrow_forward
- In Blue j 1. Create a new class named Scene.2. Add a main method to the Scene class that simply creates a new Scene object like this:Scene scene = new Scene();This should be all that is in main at this point.3. Add a public method named animate that has no parameter variables and returns nothing. Leavethe body blank for now. (Hint: What should the return type of animate be?)4. Add two House fields to Scene. Call them house1 and house2.5. Add a sun field that can reference a Circle object.6. Add a moon field that can reference a Circle object.7. Create a no-arg constructor for the Scene class that creates the two House objects shown in the imagebelow. Use the methods you created in the preceding activity to position and color the houses exactlyas in the image. We will adopt the convention that house1 refers to the left house and house2 refersto the right house. 8. Add a sun to the upper-left corner of the scene. (Create the sun object and set the color, position, andsize in the no-arg…arrow_forwardAssuming that MotorBicycle is a subclass of Bicycle, select all of the codes that overload the applyBrake method. To better view the option, right-click the image and select "Open image in new tab."arrow_forwardIn this exercise, you are going to build on your Circleclass from the previous exercise. You are going to add 2 method, areaDifference and perimeterDifference. Both methods take a doubleradius of a second circle and return the difference from the current circle. For example, if you create a Circle object with a radius of 4 and call areaDifference(3), you will return the diffence between the area of a circle with radius 4 and the area of a circle with a radius of 3. perimeterDifferencewould be the same. Make sure you create at least one Circle and test and print the results of your methods. in javaarrow_forward
- In this exercise, you are going to build on your Circleclass from the previous exercise. You are going to add 2 method, areaDifference and perimeterDifference. Both methods take a doubleradius of a second circle and return the difference from the current circle. For example, if you create a Circle object with a radius of 4 and call areaDifference(3), you will return the diffence between the area of a circle with radius 4 and the area of a circle with a radius of 3. perimeterDifferencewould be the same. Make sure you create at least one Circle and test and print the results of your methods. given: public class Circle{private double radius;public Circle(double theRadius){radius = theRadius;}// Add a method called area that returns the area of a circle// using Math.PIpublic double area(){return Math.PI*radius*radius;}// Add a method called perimeter that returns the perimeter of a// circle using Math.PIpublic double perimeter(){return Math.PI*2*radius;}}arrow_forwardThere needed to fix something in the above solution. Please repost the solution with these changes. Thank you!! Use Bootstrap classes to make a circular image with a border around the image only.arrow_forwardCurrently, there are two draw rectangle methods in the DoodleController class. Since two different turtles need to draw a rectangle, create a draw rectangle method in the DoodleTurtle class that will take the width and height of the rectangle as parameters and draw a rectangle of the specified size. The size will be the number of steps by the turtle. With the new method introduced, the calls to drawRectangleWithLittleTurtle and drawRectangleWithBigTurtle can be replaced with a call to the turtle’s drawRectangle method passing in the desired size of the rectangle. Refactor the DoodleController accordingly. Note: When you are done with the refactoring the drawRectangleWithLittleTurtle and drawRectangleWithBigTurtle method in the DoodleController need to be deleted. After this refactoring, do not move on until you verify the program works as it did before.arrow_forward
- Implement the ShoppingCart and Product class with necessary properties so that the given output is produced. Do not change any given code.s1 = ShoppingCart()p1 = Product("Razer BlackShark","Headset",99.99,5)p2 = Product.createProduct("Razer Huntsman","Keyboard",249.99,12)print("1.====================================")s1.addGadget(p1,p2)print("2.====================================")s1.setCartName("Amazon")s1.addGadget(p1,p2)s1.addGadget(Product("HyperX Fury","Mousepad",26.99,21))print("3.====================================")print("Total Products created:",Product.totalProducts)print("4.====================================")s1.printCartDetails()print("5.====================================")s1.removeFromCart("Logitech G ProX Superlight")print("6.====================================")s1.removeFromCart("Razer Huntsman")print("7.====================================")s1.printCartDetails()Output:1.====================================Please set the cart name…arrow_forwardWhen I write the code here to visual studio, I get errors and I don't know how to fix it. Please examine it in detail and I would appreciate it because I have no right to ask any more questions. class Main { public class GameManagement { // This class holds all the team & score management private List<Team> teams = new ArrayList<Team>(); private int countTeam; private static int MAX_TEAMS=8; public GameManagement (){ try { FileReader fr = new FileReader("player.txt"); // reading from the text file Scanner in = new Scanner(fr); while (in.hasNextLine()){ String line = in.nextLine(); Team team = new Team(line); teams.add(team); } } catch (...) {} } public List<Team> getTeams(){ return teams; } } public class GameTournamentGUI extends JFrame { GameManagement manager…arrow_forwardAdd a String instance variable, messageUponExiting, to the Window class. This variable will be used to display a message when the user closes the window (for example, "Are you sure you want to quit?"). Furthermore, this variable should be accessible to all subclasses of the Window class, as each sort of window may require a different message upon exiting. Please provide the declaration of the instance variable only—nothing else.arrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage