Concept explainers
(Geometry: two rectangles intersect?) Write a
Want to see the full answer?
Check out a sample textbook solutionChapter 16 Solutions
Introduction to Java Programming and Data Structures: Brief Version (11th Global Edition)
Additional Engineering Textbook Solutions
Problem Solving with C++ (10th Edition)
Thinking Like an Engineer: An Active Learning Approach (4th Edition)
Introduction To Programming Using Visual Basic (11th Edition)
Database Concepts (8th Edition)
SURVEY OF OPERATING SYSTEMS
Java: An Introduction to Problem Solving and Programming (8th Edition)
- Write the following function that draws a line from point (x1, y1) to (x2, y2) with color (default to black) and line size (default to 1).def drawLine(x1, y1, x2, y2, color = "black", size = 1):arrow_forward(In Java) In the game Clacker, the numbers 1 through 12 are initially displayed. The player throws two dice and may cover the number representing the total or the two numbers on the dice. For example, for a throw of 3 and 5, the player may cover the 3 and the 5 or just the 8. Play continues until all the numbers are covered. The goal is to cover all numbers in the fewest rolls. Create a Clacker application that displays 12 buttons numbered 1 through 12. Each of these buttons can be clicked to ‘cover’ it. A covered button displays nothing. Another button labelled Roll can be clicked to roll the dice. Include labels to display the appropriate die images for each roll. Another label displays the number of rolls taken. A New Game button can be clicked to clear the labels and uncover the buttons for a new game.arrow_forwardDebugging: There are errors in the following code snippet. Locate and fix all the errors with your own comments to get full credit for the question. Assume the goal of the program is to perform a simulation to estimate the probability of rolling three of a kind in a single roll of three six-sided dice. File Edit Format Run Options Window Help # Estimate the probability of rolling three of a kind # in a singel roll of three six-sided dice. def main (): n input ("How many rolls would you like to simulate?") hits = 0 for i in range (n): if equalRolls (3): hits += 1 print ("Estimated prob = ", float (hits) /n) def equalRolls (count): first = randrange (1,7) for i in range (count) : roll if roll != first: return False return True name ------ randrange (1,7) 1 if main () Note: your output will not be exactly the same due to (pseudo)randomness Test Case1: How many rolls would you like to simulate? 100 Estimated prob = 0.01 _main____¹: Test Case2: How many rolls would you like to simulate?…arrow_forward
- 2 Write a program that will assign a suitable name to a given RGB triplet. Your names must be a hue (such as 'RED’,’ORANGE','GREEN-YELLOW’,BLUE-PURPLE’, etc.) preceded by some adjectives (such as "light", "greyish", "dark", "creamy", etc.). Use your own imagination. 3 Write a program that can display a colour image, as well as any one of the primary colour plans (RED, GREEN, BLUE) and also the secondary planes (CYAN, MAGENTA, YELLOW), asarrow_forward(this question is part 2 of 3 in a long problem) JavaScript Commands Create the nameSearch variable equal to the value entered in the nameSearch input box. Users can search for names in three ways: Matching an employee's last name if it contains the text string specified in nameSearch Matching an employee's last name if it begins with the nameSearch text string Matching an employee's last name only if it exactly matches the nameSearch text string. Richard has supplied you with code to add the selectedValue() method to the prototype of the HTMLSelectElement object class in order to return the value of the selected option in any selection list. Apply the selectedValue() method to the nameSearchType selection list to return the option selected by the user, storing the value in the nameSearchType variable. Create a switch-case structure for the following possible values of the nameSearchType variable: If nameSearchType equals "contains", use the new RegExp() constructor to create a…arrow_forwardAny help with this first problem would be really helpful! Thank you so much!! Please display a screenshot of the code so I see the correct format and learn the proper way. Thank you!! 1. Write the following exercise using Java code. Add comments in each program to explain what your code is doing. Write a program that generates a two-column table showing Fahrenheit temperatures from -40F to 120F and their equivalent Celsius temperatures. Each line in the table should be 5 degrees F more than the previous one. Both the Fahrenheit and Celsius temperatures should be accurate to 1 decimal place.arrow_forward
- 1. Write a program that prints your full name. Write a program that prints your full name using asterisk(*). Write a program that prints a square, a rectangle and a triangle using asterisk. Write a program that adds THREE(3) numbers. Write a program that multiply THREE(3) numbers. Write a program that divides TWO(2) numbers.arrow_forwardWrite the following function to draw a regular polygon:def drawPolygon(x = 0, y = 0, radius = 50, numberOfSides = 3):The polygon is centered at (x, y) with a specified radius for the bounding circle for the polygon and the number of sides. Write a test program that displays a triangle, square, pentagon, hexagon, heptagon, and octagon, as shown in Figure 6.12a.arrow_forward4) fence.py Let's build a fence. Write a program that asks the user to enter an integer n, and then uses the turtle module to make this type of "fence" shape, with n vertical "posts" (shown here with n = 8): The fence should have n vertical lines, connected with two horizontal lines (one at the bottom, and another close to the bottom). Specifications: your program must • ask the user to input an integer n which is greater than or equal to 2 (you may assume the user complies). • use the turtle module to draw the "fence" shape shown above, except with n posts (here, 8 posts are shown). The turtle may end wherever you like, as long as the stack has been drawn. Challenge: Write your program so that when the user enters n, the turtle draws multiple fences: first it draws the 2-post fence, then the 3-post fence below it, then the 4-post fence, and so on, until the n-post fence is drawn.arrow_forward
- can you please write it in java.util.scanner form Write a program that prompts the user to enter a number within the range of 1 through 10. The program should display the Roman numeral version of that number. If the number is outside the range of 1 through 10, the program should display an error message. but use switch statement for the program.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_forwardObject-Oriented Programming ------------------------------------arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning