Java | JSP | JSF Answers

Questions: 4 418

Answers by our Experts: 3 943

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

how to sort an array list without using a collection
The insert statement is working fine for one table but when I try to insert into two it gives an error. Could you see the code below and give me any feedback?

public void insertContact() throws SQLException {

System.out.println("Please enter your ID");
String id = input.next();
System.out.println("Please enter your phone number");
String number = input.next();

try (Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE)) {

ResultSet rs = stmt.executeQuery("SELECT * FROM Contact "
+ "LEFT OUTER JOIN ContactTelNo "
+ "ON Contact.ContactId = ContactTelNo.ContactId");

rs.moveToInsertRow();
rs.updateString(idTable, id);
rs.updateString(numberTable, number);
rs.insertRow();
}
}
Method 1: createArray

Write a method that creates an integer array of size 100. Once created, use some type of loop to fill the array with random integers. Make sure these integers are in the range [0-99]. This method should accept no parameters and return an integer array. Therefore, the method header should look as follows:

public static int[] createArray()





Method 2: statsDisplay

Write a method that performs some rudimentary statistics on the recently created array. The statistics to take are as follows:

Count and display the amount of even numbers (Note: You do not have to print the actual numbers).

Count and display the amount of odd numbers (Note: You do not have to print the actual numbers).

Calculate and display the average.
I need help getting a static method to print a number after multiplying it
. Write a Java program that displays the ASCII characters for values from 33 to 126, inclusive. Print 20 characters per line, each character separated from the next by 2 spaces
Write a Java program that displays a table of square roots and cube roots. Use a loop to print the roots of numbers from 0 to 100, in increments of 5, as shown below. Output formatted columns with the number of decimal places as shown.

roots table
Write a Java program that can add up and count a series (any number) of integers entered by the user. Use a loop and stop the loop when the user enters a value of zero. Then, display the count, total and average. Express the average accurate to three decimal places.

SAMPLE RUN
Enter a number or 0 to quit: 12
Enter a number or 0 to quit: 5
Enter a number or 0 to quit: 41
Enter a number or 0 to quit: 0
The total of those 3 numbers is 58.
The average is 19.333.
Here is some data regarding an employee:

name: William
age:25
hourly pay rate: $18.50
office: B
Assign these data items to suitable Java variables, then use the variables and three statements to print these formatted lines of output:

Will is 25 years old
He is in office B
In a 40-hour week, his pay is $740.00
Prompt the user to enter a three word phrase as one string and then:

Display the number of characters (including spaces) in the phrase.
Display the number of characters in the middle word.
Display the final word in all upper case.
2. Google an ASCII table and note that values from 48 to 122 represent characters in three categories; digits, special characters, or letters of the alphabet. Write a Java program that generates a random integer from 48 to 122, inclusive. Then use methods of the Character class in selections to detect and report the ASCII category of the character for that integer. Include case if the character is a letter. See example outputs below.
Example Outputs

The integer is 71
The ASCII character for that is G
That is an upper case letter

The integer is 61
The ASCII character for that is =
That is punctuation or a special character

The integer is 102
The ASCII character for that is f
That is a lower case letter
LATEST TUTORIALS
APPROVED BY CLIENTS