(Connected rectangles) Listing 28.10, ConnectedCircles.java, allows the user to create circles and determine whether they are connected. Rewrite the
Want to see the full answer?
Check out a sample textbook solutionChapter 28 Solutions
Introduction to Java Programming and Data Structures, Comprehensive Version Plus MyProgrammingLab with Pearson EText -- Access Card Package
Additional Engineering Textbook Solutions
Web Development and Design Foundations with HTML5 (8th Edition)
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
Starting Out with Java: Early Objects (6th Edition)
Programming in C
Software Engineering (10th Edition)
Problem Solving with C++ (9th Edition)
- PLEASE CODE IN PYTHON The Penny Pitch game is popular in amusement parks. Pennies are tossed onto a board that has certain areas marked with different prizes. For example: The prizes available on this board are puzzle, game, ball, poster, and doll. At the end of the game, if all of the squares that say BALL are covered by a penny, the player gets the ball. This is also true for the other prizes. The board is made up of 25 squares (5 x 5). Each prize appears on three randomly chosen squares so that 15 squares contain prizes.In Python, create a PennyPitch application that displays a Penny Pitch board (use [ and ] to indicate squares) with prizes randomly placed and then simulates ten pennies being randomly pitched onto the board. After the pennies have been pitched, the application should display a message indicating which prizes have been won, if any.arrow_forwardClick the four endpoints of the rectangles given in the java statements. 1. g.drawRect(600, 0, 200, 450)arrow_forwardPlease help me with this , I am stuck ! PLEASE WRITE IT IN C++ Thanks 1) bagUnion: The union of two bags is a new bag containing the combined contents of the original two bags. Design and specify a method union for the ArrayBag that returns as a new bag the union of the bag receiving the call to the method and the bag that is the method's parameter. The method signature (which should appear in the .h file and be implemented in the .cpp file is: ArrayBag<T> bagUnion(const ArrayBag<T> &otherBag) const; This method would be called in main() with: ArrayBag<int> bag1u2 = bag1.bagUnion(bag2); Note that the union of two bags might contain duplicate items. For example, if object x occurs five times in one bag and twice in another, the union of these bags contains x seven times. The union does not affect the contents of the original bags. Here is the main file: #include <cstdlib>#include <iostream>#include "ArrayBag.h"using namespace std; template…arrow_forward
- • 5. Given the corner points of a triangle (x1, y1), (x2, Y2), (x3, y3), compute the area. Hint: The area of the triangle with corner points (0, 0), (x1, yı), and (x2, y2) is |¤1· Y2 – 2 · Yı| Geometry.java 1 public class Geometry 2 { 3 /** Computes the area of a triangle @param x1 the x-coordinate of the first corner @param yl the y-coordinate of the first corner @param x2 the x-coordinate of the second corner @param y2 the y-coordinate of the second corner @param x3 the x-coordinate of the third corner @param y3 the y-coordinate of the third corner @return the area of the triangle */ public static double triangleArea (double x1, double y1, double x2, double y2, double x3, double y3) { double area = (Math.abs (x1*y2 - x2*yl))/2; return area; 4. 6. 10 11 12 13 14 15 16 17 18 19 } CodeCheck Resetarrow_forwardProject 9: The digital root of a positive integer is found by summing the digits of the integer. If the resulting value is a single digit then that digit is the digital root. If the resulting value contains two or more digits, those digits are summed and the process is repeated. This is continued as long as necessary to obtain a single digit. For example, consider the positive integer 24. Adding the 2 and the 4 yields a value of 6. Since 6 is a single digit, 6 is the digital root of 24. Now consider the positive integer 39. Adding the 3 and the 9 yields 12. Since 12 is not a single digit, the process must be repeated. Adding the 1 and the 2 yields 3, a single digit and also the digital root of 39. File: Input The input file will contain a list of positive integers, one per line. The end of the input will be indicated by an integer value of zero. Output File: For each integer in the input, output its digital root on a separate line of the output. Example Input: 24 39…arrow_forwardCode with comments and output screenshot. Thank you!! Write a java method that receives a string containing letters of the English alphabet and then prints the Letters having unique frequencies. Notes: 1) Ignore letter case; Uppercase and lowercase letters are considered the same. 2) Do not use methods from the Arrays class.arrow_forward
- What will the following code print? Show your work.arrow_forward(Check password) Some websites impose certain rules for passwords. Write a method that checks whether a string is a valid password. Suppose the password rules are as follows: A password must have at least eight characters. A password consists of only letters and digits. A password must contain at least two digits. Write a program that prompts the user to enter a password and displays Valid Password if the rules are followed or Invalid Password otherwise.arrow_forward(Game: scissor, rock, paper) Write a program that plays the popular scissor–rock–paper game. Rules: A scissor can cut a paper, a rock can knock a scissor, a paper can wrap a rock. The program should randomly generates a number 0, 1, or 2 representing scissor, rock, and paper. The program should prompt the user to enter a number 0, 1, or 2 and displays a message indicating whether the user or the computer WINs, LOSEs, or DRAWs.arrow_forward
- WHAT IS PRINTED INTHE FOLLOWING PIECE OF CODE ?arrow_forwardExercise#3: Calculate the area and perimeter of square.arrow_forwardWATERSORT PROGRAM - JAVA •The aim of Part 2 is to set up the puzzle for the player to solve in Part 3. IMPORTANT NOTE: We are not going to start with 2 empty bottles, but rather with 8 empty slots spread over the 5 bottles as explained in the intro video. Start with 5 empty bottles. Use a random number generator to fill bottles one slot at a time with the colours while keeping 8 slots empty – there is a total of 5*4 = 20 slots – so if we will 12 slots, 8 are free. •Advantage: Easy to create a puzzle with a good mix •Disadvantage: With more colours and bottles and only 2 open bottles for more advanced versions of the game, the result might not be solvable. Start with three sorted bottles. In the strategy the idea is to load three bottles with uniform colour and then move ink around for a number of moves until the bottles are mixed up. •Advantage: Result is always solvable since the bottles are created in a reversed-game strategy. •Disadvantage: It is hard to develop an algorithm which…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education