493 Answered Questions for the topic Java
Java
08/08/20
Solve the question.
Use the 'Selection Sorting Algorithm for Comparable[ ] array' (or any sorting algorithm that can handle Comparable[ ] type array sorting) to arrange words in increasing length order. If same length...
more
Java
08/08/20
Shown below is the 'Partition Algorithm' we developed.
public static void partition(int[ ] data, int pivot) {int i=0, j=data.length-1;int temp;while(i<=j) {while(data[i]<pivot) i++;while(data[j]>pivot) j--;if(i<=j) {temp = data[i];data[i] =...
more
Java
08/08/20
An array is going through the sorting process by the 'Merge Sort algorithm'. Fill all arrays:
8 3 9 1 5 8 7 4 ----->recurse downA. ------>B. -----------> F. return back up-------> ...
more
Java
08/08/20
Discuss performance of the "Merge Sort algorithm":
Time: O(_____) ~ O(_____)Space (memory): _______________________________
Java
08/08/20
We like to merge the two arrays, A and B, into one, using the Merge Algorithm. Fill the arrays:
A A --------> 8 1 3 5 ----> CB 2 2 4 5 6 9 ----> ...
more
Java
08/08/20
What will be printed out on the console?
A.int aa = 5;aa = aa++;System.out.println(aa);B.int[ ] aaa = {3, 7, 1, 4, 6, 2, 8};int i = 1;aaa[0] = aaa[i++ + ++i];for(int k=0; k<i; k++) System.out.print(aaa[k] + " ");C.for(int i=0;...
more
Java
07/25/20
Try to solve this problem please
You are given a data file which contains data for creating student objects.See the attached “students.txt” file.Also, for your convenience, ‘Utility.class’ is attached.However, it is not completed...
more
Java
07/25/20
Complete the design of ‘Student’ object below. Make it a decent design. We will sort student objects in alphabetical of last names (if last names are same, then will use first names).
public class Student {private String lastName;private String firstName;private int grade;private char gender;private double GPA;public Student(String line) {// code}// Minimum four more methods}
Java
07/25/20
Method shown below can do “Insertion Sorting” for integer arrays. Modify it so that it can sort any type array, object types and primitive types.
public static void sort(int[] data) {int i, j, temp;for(i=1; i<data.length; i++) {temp = data[i];for(j=i-1; j>=0; j--) {if(data[j]>temp) data[j+1] = data[j];else break;}data[j+1] = temp;}}
Java
07/23/20
java programming
Some people remain old fashioned and John is one of them. He doesn't like the new smart phones with full keypads and still uses the old keypads which require you to tap a key multiple times to type...
more
Java
07/20/20
Multiple choice quiz source code JAVA
I have implemented the following code. I just want the program to keep prompting the user until a valid response is entered. Can anyone help? I want that if user enters any other character other...
more
07/20/20
Java Programming - Unclosed Literal
For the following code I'm getting an error message saying :test.java:78: error: unclosed character literal Person p = new Person(1, "G", 12,'female'); ...
more
Java
07/12/20
The following sorting method will rearrange all elements in the array in ascending order. Modify it so that it will sort elements in descending order. Show only the line(s) you would modify.
public static void sort(int[] values) { int i, j, temp; for(i=1; i<values.length; i++) { temp = values[i]; for(j=i-1; j>=0; j--) { if(values[j]>temp) values[j+1] =...
more
Java
07/11/20
Finish the java code.(this is for insertion sorting)
public class RecursiveInsertionSorting{ public static void sort(int[ ] data) { sort(data, __);} private static void sort(int[] data, int endIndex) { if(endIndex==data.length) _____; int i; int temp...
more
Java
07/11/20
I need to fill in the blanks. This is selection sorting using recursion.
public class RecursiveSelectionSorting { public static void sort(int[ ] data) {sort(data, 0); } private static void sort(int[ ] data, int beginIndex) { if(beginIndex==data.length-1) _______; int...
more
Java
07/11/20
What is the answer of this problem?(This is for java code)
When rearranged in ascending order using the insertion sorting algorithm,which one among the arrays listed below will need the fewest changes of positionsfor the elements?a. { 3, 5, 4, 1, 2}b. { 5,...
more
06/22/20
Java Classes & Objects
How do we calculate the average marks of s, s1, s2 & s3class Test{ public static void main(String args[]){ Student s; s = new...
more
06/07/20
I am having difficulty on why my program cannot be outputted. Can you please tell me where I did wrong. My code is pasted below.
import hsa.Console;import java.awt.*;import java.io.*;import java.util.*;public class HangMan{ static Console c; public static void main (String []args) throws IOException { // Main Method. ...
more
06/07/20
I need to have a functional code that can do the following requirements. My game is hangman. My question is that I don't what to start.
I need a functional program that has all the requirements:Final Programming Assignment.For the selected game, my program must provide the following features: • Player vs Computer format. • A game...
more
Java Javascript
06/05/20
write a java script code to accept a number and write a function to calculate sum of digits of that number
Java
06/01/20
solution for this problem
Sum of Odd and Even DigitsProblem Statement :Write a java program to calculate the sum of odd and even digits in a number. The input consists of a single integer 'n' which corresponds to the given...
more
05/25/20
I can't make a my character move when I run my javascript (Intellij), what is wrong with my code?
package movement;
import processing.core.PApplet;
import processing.core.PImage;
public class LunasAdventures extends PApplet {
PImage moth;
PImage bg;
public static void...
more
05/23/20
Psuedeocode Question Help
In psuedeocode suppose you want to compute the average weight of a group of items. To do this, initialize cumulativeWeight to 0, count to 0, and more to ‘y’. Then enter a loop that repeats while...
more
05/21/20
Binary Search - Java
Question :Write a java program to search an element in a sorted list and output the position using binarysearch algorithm. Use separate function search (element, array) to search an element.Format...
more
05/11/20
Selection Sort - Java
Write a Java program to implement the selection sort algorithm in Java, input the following array and display the sorted on the screen. Write a function selectionsort(Arr,N), which sort the array...
more
Still looking for help? Get the right answer, fast.
Ask a question for free
Get a free answer to a quick problem.
Most questions answered within 4 hours.
OR
Find an Online Tutor Now
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.