For each question, please show your work.
4. (10 pts) Suppose that list1 (ArrayList<Object>) is a list that contains the strings “red”, “yellow”, and “green”, and that list2 (ArrayList<String>) is another list that contains the strings “red”, “yellow”, and “blue”. Answer the following questions (All the questions are independent to each other):
What is list1 after executing list1.addAll(list2)?
What is list1 after executing list1.add(list2)?
What is list1 after executing list1.removeAll(list2)?
What is list1 after executing list1.remove(list2)?
What is list1 after executing list1.retainAll(list2)?
What is list1 after executing list1.clear()?
What is list1 after executing list1.addAll(list2)? [red, yellow, green, red, yellow, blue] What is list1 after executing list1.add(list2)? Compile-time error. Error: "java: incompatible types: java.util.ArrayList<java.lang.String> cannot be converted to java.lang.String" What is list1 after executing list1.removeAll(list2)? [green] What is list1 after executing list1.remove(list2)? [red, yellow, green] What is list1 after executing list1.retainAll(list2)? [red, yellow] What is list1 after executing list1.clear()? []
For each question, please show your work. 4. (10 pts) Suppose that list1 (ArrayList<Object>) is a...
iii.print out the arraylist iv.reverse all the elements v.print
out this arraylist vi.make a clone of the arraylist
vii.remove all the elements at any odd index of the original
arraylist (not the cloned one)
viii.print out the original arraylist ix.reverse the cloned
arraylist x.print out the cloned arraylist (this arraylist should
still contain the original sequence of elements in order)
xi.merge the cloned arraylist to the original arraylist (please
think about what happens and draw a diagram for yourself to...
Game Development: Uno For this assignment you will be creating the game of Uno (See the accompanying pdf for the instructions of the game). Your version will adhere to all the rules except that only the next player can issue a challenge against the previous player in regards to penalties, and your games must have at least three (3) players and at most nine (9) players. To begin, you must create the class Card which contains: Private string field named...
Complete the following problem. You do not need to show work, but please number your answers so that they correspond to the questions below. A jar of candy contains 115 white, 75 green, 95 blue, 60 yellow, 45 orange, 50 pink and 55 red pieces. What is the probability of drawing a yellow? What are the odds in favor of drawing a yellow? Explain how you could have obtained the answer for number 2 by only looking at the answer...
Can someone help with this problems please
1. (10 pts] Suppose that for a given term, data is collected on the types of courses that SPSCC students take with an interest in online and evening courses. Answer the following questions using the distribution of students below. Online Course No Online Course Totals Evening Course 28 42 70 No Evening Course 82 200 282 Totals 110 242 352 a. What is the probability a student is taking an online course? b....
Use Python 3 Create a program that uses Turtle to draw shapes. Show the following menu: Enter Circle Enter Rectangle Remove Shape Draw Shapes Exit Circles – User inputs position, radius, and color. The position is the CENTER of the circle Rectangles – User inputs position, height, width, color. The position is the lower left-hand corner Colors – Allow red, yellow, blue, and green only Remove – Show the number of items in the list and let the user enter...
Spanish Vocabulary Helper For this assignment, we are going to work with adding and removing data from arrays, linear search, and File I/O. In addition, you will learn to work with parallel arrays This program will assist an English-speaking user to build their vocabulary in Spanish This program will read a file containing a list of words in English and another containing the translation of those words in Spanish. The words and corresponding translations should to be stored in two...
Find the number a Show your work. ssistentes for "cach situation using a list, free diagram or table. " You olla her cute s mes.llow many Many wies are possible? 2. Carmen has a deck of cards wwwbe wutcomes are possible! Wheted10She picks one card and flips a coin. How many 3. Kendall has three jars of poll' balls. O orange and purple golf ball. The third Ball from cach jar Iwany outcomes arep & Oriejar has a white and...
This question is about java program. Please show the output and the detail code and comment.And the output (the test mthod )must be all the true! Thank you! And the question is contain 7 parts: Question 1 Create a Shape class with the following UML specification: (All the UML "-" means private and "+" means public) +------------------------------------+ | Shape | +------------------------------------+ | - x: double | | - y: double | +------------------------------------+ | + Shape(double x, double y) | |...
JavaFX program - Add a second level to the game. //Main game object/class package main; import java.util.ArrayList; import javafx.animation.AnimationTimer; import javafx.beans.binding.Bindings; import javafx.beans.property.SimpleIntegerProperty; import javafx.beans.property.SimpleStringProperty; import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.control.Label; import javafx.scene.image.ImageView; import javafx.scene.layout.HBox; import javafx.scene.layout.Pane; import javafx.scene.paint.Color; import javafx.scene.shape.Rectangle; import javafx.stage.Stage; public class Game extends Pane implements Runnable { // instance variables private ArrayList<MOB> mobs; private ArrayList<Rectangle> hitBoxes; private ArrayList<Treasure> treasure; private Player player; private final ImageView background = new ImageView(); private Level level; private SimpleIntegerProperty score; private...
PLEASE ANSWER QUESTIONS 4,5,6 and show work!
All questions 4 points each. 1) If a single die is tossed once, find the probability of a 7 Ci A) 0 B) 7 91 2) A new drug being tested is supposed to lower cholesterol. This drug was given to 300 people with the following results A Higher Cholesterol Cholesterol Not Changed Lower Cholesterol 138 14 148 If a person is testing this drug, what is the probability that his cholesterol will...