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

Command line argument in java programming

Command line argument count program in java

Write Java program that randomly generate two Integers between 1 and 10 as input and perform an operation (+,-,*,x,/) on them and displays the result of that operation. The program should tell the user whether the result is an even number or odd number. If the result is an even number the program should generate again two integers and repeat the process again. The program will only stop when the result of the operation is an odd number.

Hint: (An even number is a number that can be divided into two equal groups. An odd number is a number that cannot be divided into two equal groups)

Expected output of the program

The number of time the program generated the random number.

The value of the odd that stops the program.

Marks allocation

1. Use of a random function - 10 Marks

2. Use of a loop - 10 Marks

3. Use of a switch case 10 Marks

4. The use of a sentinel value - Odd number to stop the program - 10

4. correct output- 10


Ms. Blanchett owns 5 apartment buildings. Each building contains 10 apartments that she rent out for RM 500 per month each. The program should output 12 payment coupons for each of the 10 apartments in each of the 5 buildings. Each coupon should contain the building number (1 through 5), the apartment number (1 through 10), the month (1 through 12), and the amount of rent due.


A method called absoluteValue, which takes as its only parameter a value of type double, and

returns a value of type double. The parameter represents an arbitrary number, and the value returned

by the method represents the absolute value of this arbitrary number. The absolute value of a number

x, denoted |x|, is x if x is greater than or equal to 0, and -x if x is less than 0. For example, suppose the

following method call is executed:

double value = MathAssignment.absoluteValue(-42.0);

After the execution of the above method call, the value stored in variable value will be 42.0, as the

absolute value of -42 is 42.

3. Now write the main method and call both methods with appropriate arguments. Make sure that you

call both methods with enough valid values to show their


Control Structures: As a build-up from the previous question, consider 3 possible scenarios of input: A character, number, or word. Your program should then do the following:

  • In case the input is a character it should indicate if it’s a vowel or not
  • when a number is entered then it’s should check if it’s a prime
  • Finally, if a word is entered the system should check if it’s a palindrome or not.

As a build up from the previous question, consider 3 possible scenario

of input : A character, number or word. You program should the do the following: In case

the input is a character it should indicate if it’s a vowel or not, when a number is entered

then it’s should check if it’s a prime and finally if a word is entered the system should check

if it’s a palindrome or not


Control Structures: As a build up from the previous question, consider 3 possible scenario of input : A character, number or word. You program should the do the following: In case the input is a character it should indicate if it’s a vowel or not, when a number is entered then it’s should check if it’s a prime and finally if a word is entered the system should check if it’s a palindrome or not. Sample Run1 Sample Run3 Enter a character, number or word: c Enter a character, number or word: 7 Output1: C is not a vowel Output3: 7 is a prime number Sample Run2 Enter a character, number or word: programming Output2: Programming is not a palindrome


Given a positive number, create an array with that number as a size and populate it with the items/names provided. Additionally, the program should print out the longest name in the array. Sample Run1 3 Apple Banana Kiwi Output1: Banana is the longest name


Given a positive number, create an array with that number as a size and populate it with the items/names provided. Additionally, the program should print out the longest name in the array. Sample Run1 3 Apple Banana Kiwi Output1: Banana is the longest name


LATEST TUTORIALS
APPROVED BY CLIENTS