Concept explainers
In java write code that will take in input from a user containing two sets. Then you will complete all 6 set operations on those sets. Your user input/output should look similar to the assignment Set Operations Assignment (which is attatched) The universal set is all integers from 1 to 100.
Ideally your code would be able to accept all types of input but for practice we are going to stick to integers. You should test your code with more than the following inputs but I will be grading you based on if your code is able to accept the following as user input (one set/pair at a time) and give the correct output for the given set (do not hard code it for the all sets at once, the output should be determined by the code based on the input, meaning I could put any two set integers as input and it should work):
S = {1, 2, 3, 4} T = {3, 4, 5, 6}
S = {1, 3, 5} T = {3, 4, 5, 6}
S = {10, 13, 22, 41} T = {40, 60, 80}
S = {3, 10} T = {1, 2, 3}
S = {10} T = {3}
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 9 images
- Lets say we are creating a python game. A word is displayed gets displayed on the screen. The players of the game must type as many words as they an that are related to the word that is displayed. If players type in the same word multiple times, it is ignored. One the players are done taking turns, the program gives each player a score that is based off how many wrods they entered that are similiar to what other words players have entered. So for a player to get a point, the word they typed must be typed by another student. QUESTION: We need to store the words typed by the players and all words etered. Would we use a list, set, dict or tuple?arrow_forwardFor this assignment, you must implement the ElGamal Public-Key Encryption scheme with any programming language that you are comfortable with. The recommendation is to use C/C++ or Java. You can accomplish this assignment individually or by forming a team of 2 students. Alternatively, you can work with your team members of the previous assignment. Your program should get the "key size" from the user in terms of number of bits (for instance, 64, 128, etc). Based on the size, use Fermat or Miller-Rabin primality test algorithm to define your large prime number. You can use the existing programming packages to find a generator of your finite field. Your program should then initialize a pair of key, i.e., private and public keys. For the computations, utilize the Square-and Multiply algorithm. In fact, your program should get a plaintext from the user to perform encryption (generating the ciphertext from the plaintext) and decryption (generating the original plaintext from the ciphertext).…arrow_forwardWRITE CODE IN C LANGUANGE On their way down the river, Jojo and Lili saw two frogs each in position X1 and X2. The two frogs are seen jumping happily towards the same direction that is come to Jojo. After watching the two frogs, Joio and Lili saw that the speed the two frogs are different. The first frog to start jumping from position X1 has a speed of v1, while the second frog that starts to jump from position X2 has a speed of V2. Joig guess that "YES" both frogs will be in the same position in a certain time T, while Bibi guessing "NO" the two frogs will never be in the same position in time. Help Joio and Lili calculate the frog's movements to determine whether the guess they are rightarrow_forward
- IN HASKELL PROGRAMMING LANGUAGE PLEASE In case you do not know it: the game is played on a 3x3 grid that is initially empty. Two players are playing, by alternatingly making moves. A move by a player places their token (an X for player 1, an O for player 2) into a cell that was empty. We are using algebraic notations for indexing the positions in the board, with A,B,C indexing the columns and 1,2,3 the rows. Specifically, these coordinates would be used in the implementation for moves made by a human player. If the X X O Figure 1: Sample board position same token appears 3 times in any of the three columns, three rows or two main diagonals the game is over and that player wins. If the grid is filled without that happening the game is a draw. For the depicted board, we have Xs in positions C3 and A2, and an O in position B1. It would be O’s turn to make a move; a legal move would be C2, but it is not a good move, because X can force a win by responding A1. O cannot force a win, but…arrow_forwardThere are three main operations on rectangles: intersection, union, and difference. Among them, only intersection is guaranteed to return another rectangle. In general, the union of two rectangles is... two rectangles, and the difference between two rectangles is ... a whole lot of rectangles, as we will see. We let you implement rectangle intersection. Of course, the intersection is defined only if the rectangles have the same number of dimensions. The intersection is computed by taking the intersection of the intervals of the two rectangles for corresponding dimensions. If one of the intervals is empty, you should return None. [] # @ title Rectangle intersection def rectangle_and(self, other): if self.ndims != other.ndims: raise TypeError("The rectangles have different dimensions: {} and {}".format( )) self.ndims, other.ndims ### YOUR SOLUTION HERE Rectangle. _and_ = rectangle_and [ ] r1 = Rectangle((2, 3), (0, 4)) r2 = Rectangle((0, 4), (1, 3)) draw rectangles (r1, r2) draw…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