Consider Bag, SinglyLinkedList, and DoublyLinkedLists classes for integers. Implement and test the following methods: 1. Write a method in Bag class for integers that finds the number of odd and even numbers in the list. 5. Write a method in DoublyLinkedList class that swaps the first and last nodes in the list. 6. Write a Main class to test all these methods.
Q: B. If Alice uses the same k to encrypt two messages M¡ and M2 as (12, 65) and (12, 64), what is the ...
A: The answer is
Q: A. If a minor offense is committed by a driver, a fine of GHs 50 should be charged and the driver ca...
A: Program Explanation: Declare the header files Declare and define the main function Declare a variab...
Q: differentiate between texture map, environment map and bump map
A: Texture map:- A texture map is an image used (mapped) on a face or polygon. This can be a bitmap ima...
Q: If you could create a dashboard that met your business needs, what would you show?
A: The importance of dashboard is very increasing these days, and when it comes to analysing and proces...
Q: What exactly do we stand to gain by putting interfaces in place?
A: Introduction: The aim of interfaces is to allow computers to enforce these properties and to know th...
Q: Use JAVA - This task helps you understand how constructors work in inheritance Create a supercla...
A: The answer is
Q: A hamilton circuit exists in the ff. graph: а b. f h O True O False
A: I have answered both the questions. First we will see if the given graph has Hamilton circuit or not...
Q: Is the internet considered to be a local area network?
A: According to the question Local area network is the most common network which we can use to get inte...
Q: Recently, your company’s WAN experienced a disabling DDoS attack. Which of the following devices c...
A: WAN stands for wide area network and there are attack could be happen in the network , we have choos...
Q: How does Health Insurance Portability and Accountability Act (HIPPA)it affect the Financial and IT p...
A: iNTRODUCTION: A Health Insurance Portability and Accountability Act of 1996 (HIPAA) is a federal law...
Q: 6.Which of the following function convertsa string to a float in Python?a.int(x[,base]) b.long(x[,b...
A: 6) Function that convert string to a float in Python is float(x) i.e. option c.
Q: On which networking device are VLANs configured?
A: VLAN : VLAN is a custom network which is created from one or more local area networks. It enables a ...
Q: How many distinct binary search trees can be made out of 5 distinct keys?
A: The binary search tree is a type of tree that has at the most two child nodes for every parent node ...
Q: a. What is the syntax error in Program B. b. Correct the syntax error. You are only required to wr...
A: Note: The answers of the first three subparts are given only. Please repost the last subpart to get ...
Q: Consider the following functions as time complexities of some algorithms. (a) First write the worst-...
A: Actually, algorithm is an step by step process.
Q: What exactly is a data model, and what does it do?
A: Introduction: Data modelling is the act of defining and arranging data in order for it to be used an...
Q: 1.Write a C# Sharp program that takes four numbers as input to calculate and print the average. Tes...
A: Given: We have to write a C# Sharp program that takes four numbers as input to calculate and print t...
Q: Make a research about the DIFFERENT TYPES OF ARGUMENT & TYPES OF VARIABLE Discuss the characteristic...
A: 1) 5 Types of Arguments in Python Function Definition: default arguments keyword arguments positio...
Q: In what ways can cloud storage offer advantages and disadvantages to users?
A: Cloud storage is a cloud computing approach that stores data on the Internet via a cloud computing p...
Q: 2- According to the FPGA's cells studied, how many FPGA cells are required to implement an 8 bit rip...
A: Given: According to the FPGA's cells studied, how many FPGA cells are required to implement an 8- ...
Q: A summary on computer crime, viruses, and worms.
A: Computer crime: The Internet is a fantastic place full of fascinating possibilities. However, there ...
Q: o 1 2 5 6 92 13 37 45 56 64 18 22 3 Item = 18 4-
A: Answer is as follows (Hand written):
Q: Given the following sets: A = {2, 3, 4}, B = {1, 5, 10}, C = {-1, 1, 2}, D = {2, 5, 10} What is the ...
A: Note: This is multiple questions-based problem. As per company guidelines, only the first question i...
Q: Read a variable n from the user and generate a series of Fibonacci numbers up to the given n. The di...
A: The Fibonacci numbers are the numbers in the following integer sequence.0, 1, 1, 2, 3, 5, 8, 13, 21,...
Q: Why run a k-Means cluster p that apply. O Find groups not explicit
A: Why run a k-Means cluster process on data? Select all that apply. Find groups not explicitly labeled...
Q: Write a function that assigns the user defined values to these variables. Write another function tha...
A: Explanation: - Include all the necessary header files. - Create two functions. One for taking in...
Q: Define the term architecture formally with any two examples (Subject: Software Design and Architect...
A: Introduction: A computer system is essentially a device that automates complex activities. It should...
Q: When did the first desktop computer come into existence?
A: A computer is an electronic machine that takes input , process it and produces desired output which ...
Q: Do you understand why you need a firewall and how it might help your business?
A: Introduction A firewall is a network security device that monitors incoming and outgoing network tra...
Q: 14. What will be the output of the following Python code? x = 'abcd' for i in x: print (i.upper ()) ...
A: #14#lets analyse the code for outputx='abcd'for i in x:#for each character in x print(i.upper())#...
Q: What is an Excel worksheet? What is an Excel workbook? What kind of data should you keep on the same...
A: Introduction What is an Excel worksheet? What is an Excel workbook? What kind of data should you k...
Q: solve using c++. Let the user enter two arrays. Add(concatenation) the arrays into one extended ...
A: The solution to the given problem is below.
Q: Create a program that contains a class that converts dollars to nickels (5 cents), dimes (10 cents) ...
A: public class Total_Dollar { public static void main(String[] args) { int q; int d; ...
Q: D) Have the main method do the following: • Instantiate two instances of the Circle class with diffe...
A: logic:- define circle class with attributes radius and Color. Inside this class define method call...
Q: What SQL query is required to determine the total quantity of beers?
A: Introduction: SQL (Structured Query Language) is a standardised computer language used to manage soc...
Q: Given the ff. algorithm to find the greatest common divisor of n and m where n s m, determine the ti...
A: Question 1 Gcd(m,n) if n==0 then //θ(1) return m m=m-n θ(m) if n≤m return Gcd(n,m) else...
Q: This task helps you understand how constructors work in inheritance Create a superclass, called Su...
A: The answer is
Q: Q1: Answer the following as true or false Basic Input Output System used to start up the operating s...
A: True statements are :- Basic Input Output System used to start up the operating system. It is store...
Q: Write a C program to create two processes P1 and P2. P1 takes 2 integers (x, y) and passes it to P2....
A: A process is an executing program. When a program is compiled, it converts into a binary code. Afte...
Q: 1. Create a page to show different attribute of Font tag.USE HTML 2. Create a page to show differen...
A: PART 1: EXPLANATION: Font tag is used to manipulate the font of the text in an HTML document. There...
Q: Perform the following binary multiplications using Booth's algorithm, assuming signed two's compleme...
A: in the following image you can see the booth's algorithm to perform multiplication in binary.
Q: When you issue the ping command, what protocol are you employing to communicate with your computer?
A: The answer is given below:-
Q: CASE: WebSpective Software, Inc. Objectives of the case: - Understand the company’s requirement...
A:
Q: Sub:- Multimedia and Application Development Discuss various software tools available for graphics ...
A: The Answer is in below Steps
Q: What is the asymptotic complexity of the following functions? void foo(int n){ int i; if(n < 1)...
A: void foo(int n){int i; // O(1)if(n < 1) return; ...
Q: 6- Which of the following is False? A) Dynamic memory stores binary information in internal la tches...
A: We have given few statement regarding Static Memory and dynamic memory , we have asked to find which...
Q: Q4/ A- Find the complement of F=WX +YZ, then show that F.F=o and F+F=1 B- Obtain the 1s and 2s compl...
A: De Morgan's Theorem (A+B)'=A'.B' (AB)'=A'+B' has been used to solve the first part of the question
Q: 6. Write a function DOT-PRODUCT that takes two lists, each list has the same number of elements, and...
A: 6. Write a function DOT-PRODUCT that takes two lists, each list has the same numberof elements, and ...
Q: Given the following adjacency matrix: Nodes A B C E F A 1 C 1 1 1 E 1 1 F i) Draw a graph based on t...
A: Answer:
Q: Imagine running helloworld in the shell. Place the following steps in the correct order. A. the oper...
A: Let's imagine that magine running helloworld in the shell. We have to place the following steps in t...
Consider Bag, SinglyLinkedList, and DoublyLinkedLists classes for integers. Implement and test the following methods:
1. Write a method in Bag class for integers that finds the number of odd and even numbers in the list.
5. Write a method in DoublyLinkedList class that swaps the first and last nodes in the list.
6. Write a Main class to test all these methods.
Step by step
Solved in 2 steps
- Import the ArrayList and List classes from the java.util package to create a list of phone numbers and also import the HashSet and Set classes from the java.util package to create a set of unique prefixes. Create a class called PhoneNumberPrefix with a main method that will contain the code to find the unique prefixes. Create a List called phoneNumbers and use the add method to add several phone numbers to the list. List<String> phoneNumbers = new ArrayList<>(); phoneNumbers.add("555-555-1234"); phoneNumbers.add("555-555-2345"); phoneNumbers.add("555-555-3456"); phoneNumbers.add("444-444-1234"); phoneNumbers.add("333-333-1234"); Create a Set called prefixes and use a for-each loop to iterate over the phoneNumbers list. For each phone number, we use the substring method to extract the first 7 characters, which represent the prefix, and add it to the prefixes set using the add method. Finally, use the println method to print the prefixes set, which will contain all of…Suppose that a list contains Comparable objects. Implement a method that returns a new list of items that are less than some given item. The header of the method could be as follows: public LListgetAllLess Than( Comparable anObject) Write an implementation of this method for the class LList. Make sure that your method does not affect the state of the original list.4. Say we wanted to get an iterator for an ArrayList and use it to loop over all items and print them to the console. What would the code look like for this? 5. Write a method signature for a method called foo that takes an array as an argument. The return type is void. 6. What is the difference between remove and clear in ArrayLists.
- Add methods to the STUDENT class that compare two STUDENT objects. One method should test for equality. The other methods should support the other possible comparisons. In each case, the method returns the result of the comparison of the two students' names. Place several STUDENT objects into a list and shuffle it. Then run the SORT method with this list and display all of the students' information.In java A supermarket wants to reward its best customer of each day, showing the customer’s name on a screen in the supermarket. For that purpose, the store keeps an ArrayList.Create a class customer having id, name, gender, and bill provide appropriate getters/setters and constructors also provide toString method.In the Store class, make an ArrayList of customers, store name, and address implement methods public void addSale(Customer c) that will add customers to the arraylist.public void RemoveCustomer(int id);public void UpdateCustomerRecord(int Id);public displayAll();public String nameOfBestCustomer() to record the sale and return the name of the customer with the largest sale. public ArrayList nameOfBestCustomers(int topN) so that it displays the top customers, that is, the topN customers with the largest sales, where topN is a value that the user of the program supplies. Write a program that prompts following menu and ============================================…Write a method called changeQueue to be considered inside the ArrayQueue class and has one parameter item of type E. Your method will change the queue in such a way that if the the first element of the queue and the last element of the queue are equal, the first and last elements in the queue will be replaced with item, otherwise, do not do any change. Similarly, the same process is done for the second element in the queue and the element before the last in the queue and so on. Assume you have a non-empty queue with even number of elements. You are not allowed to call any method from the the ArrayQueue. class. Do not use iterators. Method head: public void changeQueue(E item) Examplet: Before run: front rear "this" queue: 10 29 2 25 10 Item1: 100 After run: front rear "this" queue: 100 29 100 100 5 100 Use the editor to format your answer
- Write a method called changeQueue to be considered inside the ArrayQueue class and has one parameter item of type E. Your method will change the queue in such a way that if the the first element of the queue and the last element of the queue are equal, the first and last elements in the queue will be replaced with item, otherwise, do not do any change. Similarly, the same process is done for the second element in the queue and the element before the last in the queue and so on. Assume you have a non-empty queue with even number of elements. You are not allowed to call any method from the the ArrayQueue class. Do not use iterators. Method head: public void changeQueue(E item) Example1: Before run: front rear "this" queue: 10 29 2 2 5 10 Item1: 100 After run: front rear "this" queue: 100 29 100 100 5 100Computer Science create a method +addToList(o:E):void that adds the object (o) to the ArrayList referenced by the instance variable list. create a method +removeFromBackOfList():E that removes the object at the back of the ArrayList and returns it.1.A) The median of a set of integers is the middle-most integer in size. That is, half the integers in the set are less than or equal to the median, and half the integers are greater than or equal to the median. For example, the median of {99, 1, 10, 6, 2} is 6 since 1 and 2 are smaller than 6 and 10 and 99 are larger than 6. Implement a method median( ) with no parameters that finds and returns the median of the integers in a data array. Use this keyword in meaningfully. Assume that the data array is an instance variable of Data class. Write a parameterized constructor to allocate and assign values to data array. Assume that the array has odd length. Write main () in a separate class constructor to use the Data class.
- Write a Java application CountryList. In the main method, do the following:1. Create an array list of Strings called countries.2. Add "Canada", "India", "Mexico", "Peru" in that order.3. Use the enhanced for loop to print all countries in the array list, one per line.4. Add "Spain" at index 15. Replace the element at index 2 with "Vietnam". You must use the set method.6. Replace the next to the last element with "Brazil". You must use the set method. You willlose one point if you use 3 in the set method. Do this in a manner that would replace thenext to the last element, no matter the size of the array list.7. Remove the object "Canada" Do not remove at an index. Your code should work if"Canada" was at a different location. There is a version of remove method that willremove a specific object.8. Get and print the first element followed by "***"9. Call method toString() on countries to print all elements on one line.10. Use the enhanced for loop to print all countries in the array list,…Complete ArrayStack.java, an array-based implementation o the Stack.java interface. Modify only the bodies of the following methods in the ArrayStack class: push pop top isEmpty isFull Nothing else should be modified in ArrayStack. Write the class ArrayStackTest to test your implementation. Print only the names of the tests and error messages. Give the test method meaningful names (e.g., emptyStackTest). Test push, pop, top, and isEmpty immediately after the stack has been instantiated. Push an element on an empty stack. Test pop, top, and isEmpty. Instantiate a stack with initialCapacity of 1. Push two elements. Check capacity. Other tests you deem necessary.Create a nested class called DoubleNode that allows you to create doubly-linked lists with each node containing a reference to the item before it and the item after it (or null if neither of those items exist). Then implement static methods for the following operations: insert before a given node, insert after a given node, remove a given node, remove from a given node, insert at the beginning, insert at the end, remove from a given node, and remove a given node.