Java | JSP | JSF Answers

Questions: 3 611

Answers by our Experts: 3 611

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

There was a Three

by CodeChum Admin

I'm bored with just basic counting. How about we do some complex things this time? But I don't want to be associated with any number that's not divisible by 3.


Think you can handle this?


Instructions:

  1. Print out all numbers from 1 to 100 that is divisible by 3, each in separate lines, using a for() loop.

Instructions

  1. Print out all numbers from 1 to 100 that is divisible by 3, each in separate lines, using a for loop.

Output

Multiple lines containing an integer that is divisible by 3.

3
6
9
12
15
18
21
24
27
30
33
36
39
42
45
48
51
54
57
60
63
66
69
72
75
78
81
84
87
90
93
96
99

Factorials (JAVA)

by CodeChum Admin

For those of you who may not now, a factorial is a product of multiplying from 1 until the number. Now, you must make a program that will accept an integer and then print out its factorial using loops.

Are you up for this task?


Instructions:

  1. Input a positive integer.
  2. Using a for() loop, generate the factorial value of the integer and print out the result.
  3. Tip #1: Factorials work like this: Factorial of 5 = 1 * 2 * 3 * 4 * 5
  4. Tip #2: There's a special case in factorials. The factorial of 0 is 1.

Input

A line containing an integer.

5

Output

A line containing an integer.

120

1. FizzBuzz (JAVA)

by CodeChum Admin

Instructions:

  1. Input a positive integer in one line. This will serve as the ending point of your loop.
  2. Loop from 1 to the ending point (inclusive) and perform the following statements:
  3. If the number is only divisible by 3, print "Fizz"
  4. If the number is only divisible by 5, print "Buzz"
  5. If the number is divisible by both 3 and 5, print "FizzBuzz"
  6. If nothing is true in the previous conditions, skip the number

Instructions

  1. Scan a positive integer n and store it in a variable.
  2. Create a counter variable with a value of 1 and create a loop from counter to n.
  3. Print "Fizz" if the counter in the loop is divisible by 3, "Buzz" if the counter is divisible by 5, "FizzBuzz" if it is both divisible by 3 and 5.
  4. Skip the iteration if it is not divisible by 3 or by 5.

Input

A line containing an integer.

15

Output

Multiple lines containing a string.

Fizz
Buzz
Fizz
Fizz
Buzz
Fizz
FizzBuzz




Create a program using a Java console application name it "Alphabetizer". The program should ask the user to enter is name and surname.

Create a method called emptySpace () this remove space between the name and the surname (Use a regular expression "replaceAll"). The emptySpace() method also Count the number of characters within the newly created string (nameSurname) and return the total number of Characters .

The total number of characters (Name and Surname) should be the size of your arrayAlphabetizer (type integer). Populate your arrayAlphabetizer with a series of random numbers between 10 and 50.

Display all arrayAlphabetizer elements and they are corresponding indexes before executing the sort() method and after executing the sort(). Allow the user to enter a value from the arrayAlphabetizer element to search for.

Loop through the array until you find the value and replace that value with the character @.

 Print out arrayAlphabetizer with the replaced element..


  1. Input three integers.
  2. Print the integers in ascending order.


"IF ELSE - ELSE IF STATEMENT"


Input

A line containing three integers is separated by a space.

6 1 3

Output

A line containing three integers is separated by a space.

1 3 6

Survival of the Biggest (JAVA)

by CodeChum Admin

Looping a number and taking away each digit of it is so much fun, but I wanted to try out a much more complex task: getting the largest digit among them all.

Think you can handle the job?


Instructions:

  1. Input a non-zero positive integer.
  2. Using the same concept as the previous problem, figure out how to separate the digits of a number and determine which of the digits is the largest one, using a while. Afterwards, print the largest digit.
  3. Tip #1: Create another variable that will hold the largest digit. Initial its value to a negative integer, like -1, outside the loop.
  4. Tip #2: Everytime you get the rightmost digit, check if it is greater than the current largest digit. If it is, set it as the new largest digit.

Input

A line containing an integer.

214

Output

A line containing an integer.

4

Create a short program that will print 123467.89 as currency using NumberFormat.



Sample Output:


------------------------------------------------------------------


I have ₱1,234,567.89 in my bank account.

Create a short program that will generate a random number from 0 to 100 while using Math.random and Math.round command.


Submit your answers by attaching a screenshot of your program's source code and 3 screenshot of it's output.



Write a program that declares and initializes an array of 7 integers. The program uses these static methods to perform different operations on the array:

void printArray(int[] arr) – takes the array as parameter and prints the array in horizontal order

int sumOfArray(int[] arr) – takes the array as parameter and returns the sum of the array

int getHighest(int[] arr) – takes the array as parameter and returns the highest value in the array

int resetArray(int[] arr) – takes the array as parameter and resets the value of each element to 0


Sample output:

Here’s the array: 

3 1 3 2 1 9 1

Sum: 20

Highest: 9

Here’s the array: 

0 0 0 0 0 0 0




Create a program that will allow the user to input ten numbers into an array, using values of 0 to 99, and print out all numbers except for the largest number and the smallest number.

Sample Output:

Enter the Numbers >> 10 20 10 40 50 60 70 80 90 99

Output >> 20 40 50 60 70 80 90

Try Again Y/N?


LATEST TUTORIALS
APPROVED BY CLIENTS