Need help with java problem. Start with the java file below and add the following methods:1. Add the methodpublic int getLastIndex(T item) which returns the index of the last entry which is equal to item. If item is not found, it returns -1. 2. Add the method public boolean equals(Object other) that returns true when the contents of 2 objects are the same. java file:
Q: Given A below, complete the missing entries of the matrix power A². 1 A = 1 A² 1 0 1 1 0 1 1, = 1…
A: Dear student, it seems like the A2 given by you is incorrect. I request you to cross-check with your…
Q: The role of the Internet in health care informatics . Can you please help me with this question?…
A: The integration of the Internet into healthcare, normally known as health informatics or eHealth,…
Q: One particular activity involved in logistics includes managing the outbound movements of materials…
A: The question is asking whether managing the outbound movements of materials and supplies is a part…
Q: rod1 and rod2 are instances of the Length class. Attributes start_val and end_val of both rod1 and…
A: The objective of the question is to define an instance method in the Length class that calculates…
Q: Hello, I dont have an exact question, so feel free to make one of your own example Make an NFA from…
A: Let's dive into the fascinating world of automata and formal languages. I'll walk you through the…
Q: If integer numberOfYears is 50, output "Equal to 1 half-century". Otherwise, output "Not equal to 1…
A: Java programming is a language which is used the concept of Object oriented programming language. It…
Q: Why is cyberattack issues are important for the organization
A: Cyberattack issues are important for an organization due to a multitude of reasons. The primary…
Q: Basic output with variables This zyLab activity prepares a student for a full programming…
A: 1. Start the program.2. Prompt the user to enter an integer and store it in a variable named…
Q: Information are raw facts or observations, typically about physical phenomena, or business…
A: The objective of the question is to determine whether the statement 'Information are raw facts or…
Q: Perform the following tasks: Read string customer_name from input. Create a list containing values…
A: 1) Below is code that reads the customer's name from the input, creates a list of orders, and then…
Q: Multiple key-value pairs, each representing a hotel room number and the guest's name, are read from…
A: The objective of the question is to sort the values (guest names) in the dictionary 'room_data' and…
Q: If integer degrees Celsius is 100, output "Boiling point". Otherwise, output "Not the boiling…
A: The objective of the question is to write a Java program that takes an integer input representing…
Q: he main difference between a selection sequence and a simultaneous sequence is Selection sequence c.…
A: In this question we have to understand difference between the selection sequence and simultaneous…
Q: What is the main problem with using unstructured data for decision making? A) cannot be stored in a…
A: The question is asking about the main problem associated with using unstructured data for…
Q: List experimental_data is read from input. The elements of experimental_data are separated into…
A: The objective of the question is to divide a list of data into three equal parts, representing the…
Q: Give the general expression for the Fourier series decomposition of a periodic function s(r) that…
A: The Fourier collection decomposition presents an effective approach for representing periodic…
Q: Unstructured decisions are taken at strategic level. O True O False
A: The question is asking whether unstructured decisions are made at the strategic level in an…
Q: For this C code, find the values of a, b, c and d that give hit = 1, and the result #include…
A: In this C code snippet, the objective is to determine the values of variables a, b, c, and d that…
Q: The term intranet describes an internet that extends beyond the organization that created it. O True…
A: In summary, the statement that the term "intranet" describes an internet that extends beyond the…
Q: Output the attributes of the BookInfo object book as follows: 'Genre: ' followed by book's genre…
A: The objective of the question is to print the attributes of an instance of the BookInfo class. The…
Q: A Jupyter Notebook contains two code cells. The first one reads 1 import numpy as np 2 import…
A: The following lines of code can be found in the second code cell:x = np.linspace(-1, 5, 150) [This…
Q: A Binomial distribution is defined as a number of successes in a sequence of independent Bernoulli…
A: Below is the complete solution with explanation in detail for the given question about probability…
Q: Given two schemas S and T where S has 10 Tables and 45 elements while T has only one Table with 4…
A: Machine Learning:Machine learning is a subset of artificial intelligence (AI) focused on the…
Q: enhance my understanding of the solution? Your help in navigating through this would be greatly…
A: Grammar using a single non-terminal symbol S:S → 0S0 | 1S1 | 0 | 1 | εGrammar using two non-terminal…
Q: In method cook() of the CherryPie class, perform the following tasks: Increment class attribute…
A: The objective of the question is to implement the cook() method in the CherryPie class. This method…
Q: mysql> select * from order_db; | orderid | custid | itemcode | orderquantity | deliverydate 2 | 2 |…
A: Part A:SELECT AVG(orderquantity) AS avg_order_quantity FROM order_db WHERE itemcode = 200; Part…
Q: Extract the simplest possible Boolean expression based on following compact truth table in Sum of…
A: Boolean expressions are representation of logical relationships between variables and the logical…
Q: java DDI Osrc main java > ControlPanel.java 129 v 130 131 132 133 134 135 ✓ 136 137 138 v 139 140…
A: In this question we have to write a Java code spread across multiple screenshots, which seemed to…
Q: For the given generator matrix. 0 G = 1 0 0 1 0 0 1 0 1 1 0 0 1 1 0 1 1 1 0 1 1 0 0 1 1 0 1 A.…
A: In coding theory, a generator matrix is an essential part of linear block codes. To generate…
Q: ) Write a complete C++ program that takes 10 integers from the user and stores them in an array by…
A: Initialization: Begin by declaring an array capable of storing 10 integers, intended for user…
Q: Using the MARIE computer assembly language, write a program that computes the following expression:…
A: The MARIE assembly language provides a solution to the problem of calculating the expression z =…
Q: Microsoft Access
A: To create a database named "Students" based on the template provided by Microsoft Access, you can…
Q: Part (a): Show the result of inserting 2, 0, 5, 7, 9, 1, 6, 8, 3, 4 into an initially empty binary…
A: A binary search tree (BST) is a type of hierarchical data structure in which the left and right…
Q: Describe the importance of version control systems in modern software development practices and…
A: Version control systems (VCS) have become indispensable instruments in contemporary software…
Q: ICT used in the health sector promote patient-centered healthcare, improve quality of care, and…
A: The statement is true. Information and Communication Technology (ICT) has a significant role in the…
Q: Your solution for lab #4 will be to create a C program which will accept a number of fixed verb…
A: This project presents a custom shell programmed in C, offering a basic command-line interface…
Q: String doctor_names is read from input. Split doctor_names into tokens using a vertical bar ('|') as…
A: The objective of the question is to split a string into a list of substrings using a specific…
Q: Write a function powersarray (b) that takes a list (or 1-dimensional numpy array) of length d…
A: SOLUTION-I have solved this problem B1 in Python code with comments and screenshots for easy…
Q: Explain what a BBIT is and how to use it
A: "BBIT" typically stands for "Bachelor of Business Information Technology." It's an undergraduate…
Q: Draw DFAs for the following language specifications. All strings on Σ ={A, B, C} that contain each…
A: DFA stands for Deterministic Finite Automata. It doesn't accept null moves and doesn't contain…
Q: Warm up: Variables, input, and type conversion (1) Prompt the user to input an integer between 32…
A: 1. Prompt the user to input an integer between 32 and 126, a float, a character, and a string,…
Q: 8 Provide MATLAB code to solve, please.
A: Here is a MATLAB code to solve the given boundary value problem using the finite difference…
Q: PERL code
A: Here's the summary:peter ann: 1250 bytespeter marx: 910 bytesmark mary: 1250 bytespeter mary: 50…
Q: PERL programming Consider a network with some hosts. The traffic from one host to the other is…
A: The Perl script reads input data representing bytes transferred between hosts, calculates the total…
Q: Draw DFAs for the following language specifications. All strings on Σ={A,B,C,D that match the…
A: A DFA is a mathematical model that defines a set of states and transitions between those states on…
Q: 2. The following grammar with start symbol S generates the language {011j0k : i = j or j = k}: SXO…
A: The provided analysis demonstrates the ambiguity of a given grammar by presenting two distinct parse…
Q: Dictionary doctor_on_duty contains two key-value pairs read from input. In the try block, integer…
A: The objective of the question is to handle exceptions in Python, specifically the KeyError…
Q: Consider you are a Software Engineer the task given by the manager to prepare a SRS (Use any…
A: The objective of this question is to understand the process of preparing a Software Requirements…
Q: Can you help me with this code becuase I only need help with one of the parts. I have attached my…
A: A class is a blueprint used in object-oriented programming to create objects, or instances. It…
Q: Boolean fields that represent whether the applicant is skilled in each of the following areas: word…
A: Below Create a class named JobApplicant that holds data about a job applicant. Include a name as…
Need help with java problem.
Start with the java file below and add the following methods:
1. Add the method
public int getLastIndex(T item)
which returns the index of the last entry which is equal to item. If item is not found, it returns -1.
2. Add the method public boolean equals(Object other) that returns true when the contents of 2 objects are the same.
java file:
Step by step
Solved in 1 steps
- Basic Java Help Each year, the Social Security Administration provides a list of baby names for boy and girls by state. You will write a program to read a file containing a list of baby names and display the top names. To start, implement the following class: baby names util = printTopNames(File, int): void printTopNames Will be a static method. It will accept two parameters, one is a File containing the list of names. The other is an integer that indicates how many names to display (ie, top 10 names, or top 50 names, etc). The integer argument could be any valid integer. You do not have to worry about an integer value large than 5 for the boy/girl names. This method should open the file and parse the file and print the names as shown below: Your program will use the Scanner class to read the data from the file (see your text for examples). You will also need to use a delimiter with the scanner so that the scanner will break the line apart based on the commas. For this file, set…Computer Science Consider a look-up service for the television shows on a given date. A file contains information about these shows. Each show’s data appears on two lines. The first line gives the name of the station, the channel, the name of the show, and a rating. These entries are separated by tildes (~). The second line briefly describes the show. Write pseudocode for a method with the header public void readFile(Scanner data) to read the file into a dictionary that will be searched. Decide what data should be the search key and what should be the associated value. Design any classes needed for the key and the value. Write pseudocode for the method Do not write any code for the answer. Use UML, pseudocode, and written Description.package filterSort;import java.io.File;import java.io.FileNotFoundException;import java.util.Arrays;import java.util.Scanner;import java.util.*; public class FilterSort { /*** Allocates and returns an integer array twice the size of the one* supplied as a parameter. The first half of the new array will* be a copy of the supplied array and the second half of the new* array will be zeros.** @param arr the array to be copied* @return array twice the size of <tt>arr</tt> with its initial* elements copied from <tt>arr</tt>* @throws NullPointerException if <tt>arr</tt> is null.*/public static int[] doubleArrayAndCopy(int[] arr) {int len = arr.length;int max = arr.length * 2;int[] copyArr = Arrays.copyOf(arr,max);int length = copyArr.length-1;Arrays.sort(copyArr, 0, length);return copyArr; } public static void main(String[] args) {int[] data = new int[8];try {File file = new File("data.txt");Scanner myReader = new Scanner(file);for(int i = 0;…
- Java - Encapsulation Create a class Point with attributes x and y which are both integers. Create getters and setters for these attributes and implement the following methods: 1. calculateDistance() - calculates the distance from the origin to the point. Returns a double, formula is sqrt(x^2 + y^2) 2. printCoordinates() - prints "(x,y)" Ask for user inputs for x and y. Use the methods printCoordinates() and calculateDistance() respectively. Inputs 1. X 2. Y Sample Output Enter x: 20 Enter y: 15 (20,15) 25.00In Java, we can create an array of class objects. True O FalseProblem 1: Create a Java class RecursiveMethods.java and create the following methods inside: ALL THE METHODS NEED TO BE COMPLETED RECURSIVLY. NO LOOPS ALLOWED. oddEvenMatch Rec: the method takes an integer array as a parameter and returns a boolean. The method returns true if every odd index contains an odd integer AND every even index contains an even integer(0 is even). Otherwise it returns false. sumNRec: The method takes an integer array A and returns the sum of all integers in the parameter array. nDownToOne: Takes an integer n and prints out the numbers from n down to 1, each number on its own line. inputAndPrintReverse: Inputs integers from the user until the user enters 0, then prints the integers in reverse order. For this method, you may NOT use an array or any type of array structure, in other words, you may not use any structure to store the user input. After completing the methods, use the main method to test them. You can hard code the tests.
- The file Parameters.java contains a program to test the variable-length method average.1. Read the code. Fill in the code to compute mean1 and mean2. Notice that you are calling the same method, but with a different number of parameters. 2. Add a call to find the average of a single integer, say 8. Print the result of the call. Is the result what you expected?3. Add a call with an empty parameter list and print the result. Is the result what you expected?4. Add a method called minimum to return the minimum value of the parameter list. Invoke this method in the main() and test it with different input numbers. //*******************************************************// Parameters.java//// Illustrates the concept of a variable parameter list.//*******************************************************import java.util.Scanner;public class Parameters{ //----------------------------------------------- // Calls the average and minimum methods with // different numbers of parameters.…Load your bag with some initial values, but do not fill it. Your client code should give the user the option to: display the contents of the bag using the class method “toVector” add values to the bag remove values from the bag sort the bag search for a value using their choice of either the iterative search or the recursive search - both need to be tested Allow the user to keep doing these things until they are done. Do not automatically sort the bag if the user chooses to search. Your program should give the user a message telling them they must first sort the bag before they can search.You decide what the user interface will be. Make it clear and easy to use. It can be very basic; nothing fancy. A menu driven program works well. Each value in your array should be unique - no value will appear in the array multiple times. Your array elements can be any data type – use a template class put in place in the code provided. You can write your client code to process a bag holding any…Write this program in Java using a custom method. Implementation details You will implement this program in a specific way in order to gain some experience with loops, arrays and array lists. Use an array of strings to store the 4 strings listed in the description. Use a do-while loop for your 'game engine'. This means the game starts once the user enters money. The decision to stop occurs at the bottom of the loop. The do-while loop keeps going until the user quits, or there is no money left. The pseudocode for this 'game engine' is shown below: determine the fruits to display (step 3 below) and print them determine if there are 3 or 4 of the same image display the results update the customer balance as necessary prompt to play or quit continue loop if customer wants to play and there's money for another game. Use the Random class to generate a random number between 0 and 3. This random number will be an index into the array of strings. Add the string at that index to an…
- Write a java program that saves and displays the Student Record. Ask the user to enter the data • Save and display the data Ask the user to update the data • Repeat (use loop) and ask the user to continue or not Code: • Create a class named Student • Create 2 objects for class Student • Create the public set and get the method for the Student class • Create a static method for displaying student recordPart I Explain the difference between static and non-static object with comments. Part II Write a loop that adds random number until the number reaches 1500. Use a static integer variable to count how many times the loop is executed. Part III Write a method that takes an integer value from user and returns the binary representation of the given value by using Wrapper classes. Note: Do not compress your files, submit only java files. Note: Do not forget to justify your answers with comments.Place the CashRegister calss in a file called cashregister.py and write following test code in the cell below. a Complete following test code: Import all methods of CashRegister class Write a test function to test the getTotal() and getCount() methods as it follows. add 5 items. undo the last item. add 3 more items. undo the last item after your test has done all of the above, print an statement for expected total price and total count. call the getTotal() and getCount(). (the result must be equal to the previous part) class CashRegister: def __init__(self): self._itemCount=0 self._totalPrice=0.0 self._taxPercent=13 def addItem(self,price): self._itemCount=self._itemCount+1 self._totalPrice=self._totalPrice+price def getTotal(self): return self._totalPrice def getCount(self): return self._itemCount def clear(self): self._itemCount=0 self._totalPrice=0 def updateTaxRate(self,newTaxPercent): if…