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

Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. For example, 12321 is a palindrome number.

Follow up: Could you solve it without converting the integer to a string?

Create a class named Palindrome which will contain the main method. All your code goes in the main method.

Sample Input and output:

Example 1:

Input: x = 121

Output: true

Example 2:

Input: x = -121

Output: false

Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome

Example 3:

Input: x = 10

Output: false

Explanation: Reads 01 from right to left. Therefore it is not a palindrome.

 

Example 4:

Input: x = -101

Output: false

 

Example 5:

Input: x = 3

Output: true

 


Write a java code that prompts the user to input a non-negative integer and then it will reverse the same number using a while loop. For example, if the input number is 25 the output should be 52.

Sample input and output:

Example 1:

Input: 25

Output: 52

Example 2:

Input: 123

Output: 321

Example 3:

Input: 3

Output: 3


. Write a program for: search(LA,ITEM) in Java

1. Search whether the user's entered item is exist or not in the array if exist perform following

2. Print two right neighbors(item/value) in case no right neighbor print message 'no right neighbor'

3. Print two le neighbors(item/value) in case no le neighbor print message 'no le neighbor


 Write a program for: insert(LA, K, ITEM )

1. K is not out of range

2. Item must be posive integer

3. Check user's entered ITEM at index K is greater or less than in an array at index K, if less than insert it into the array otherwise not perform any operaon, and prints the message 'ITEM’ at index k is greater than user's entered ‘ITEM' 


1. Anagrams!



by CodeChum Admin




Two strings are called anagrams, if they contain the same characters, but the order of the characters may be different.






Given a string consisting of lowercase letters and question marks, s1, and another string consisting of lowercase letters, s2, determine whether these two strings could become anagrams by replacing each ? character in s1 with a letter.






Input






1. First string






Constraints




Contains only lowercase letters and/or question marks




2. Second string






Constraints




Contains only lowercase letters




Output






The first line will contain a message prompt to input the first string.




The second line will contain a message prompt to input the second string.




The last line contains the message "anagram" if the strings could become anagrams by replacing all the ? characters of s1 with letters and "false" otherwise.





Create an OOP Java program that will ASK the user for the Prelim, Midterm, Prefinal, and Finals grades. Calculate for the FINAL GRADE (follow the calculation instructions below). Display the final grade on the console.





Calculation for Final Grade:



Get the 20% of the Prelim Grade.



Get the 20% of the Midterm Grade.



Get the 20% of the Prefinal Grade.



Get the 40% of the Finals Grade.



Add all four results. This will be the Final Grade.







1. Create two (2) classes: MyMainClass and SecondClass.




2.The class SecondClass has 5 double attributes: prelim, midterm, prefinal, finals.




3.Create one (1) constructor method to set the prelim, midterm, prefinal, and finals grades.




4.Create one (1) accessor method to calculate for and return the final grade output.




Display the final grade output in the MyMainClass.





Sample output:



Enter prelim grade:75



Enter the midterm grade: 80



Enter the prefinal grade: 90



Enter the final grade: 91



Your final grade is 85.4

Create a GUI application to enter three different numbers in three textboxes. Write a program to find the Factorial of the smallest number and factors of the largest number entered and print the result. Apply condition that the number entered must be positive only


Write a program to create two Threads. 1st Thread printing the table of the number (each after a period of 1 sec) entered by the user and 2nd Thread printing each character of the sentence after a period of 1s. Thread 1 must be executed first completely before starting of thread 2.


In reference to your module #2,Create a simple program that will print ODD or EVEN when you enter a number.

You should create two methods for a data structure implementing a Queue as a



circular array. Your data structure should have the class name MyArrayQueue. The



two methods that should be implemented are:



a) Adding element to the queue:



public void enqueue(Object theElement) {…}



[20 marks]



(Functionality: 15, Design: 2, Ease of use: 2, Presentation: 1)



b) Deleting an element from the queue and return the deleted element:



public Object dequeue() {…}



[10 marks]



(Functionality: 6, Design: 2, Ease of use: 1, Presentation: 1)



In both methods errors should be handled properly. For example what happens



when adding an element to a full queue?



There will be skeleton code for MyArrayQueue available on Learning central that



contains the MyArrayQueue class with the following fully implemented methods:



constructor, isEmpty(), getFrontElement(), getRearElement() methods. It also



includes signatures of two methods that you should implement: enqueue(Object



theElement) & dequeue().

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS