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

Create a Time class and initialize it with hours and minutes.

1- Make a method displayTime which should print the time in hh:mm:ss format.

2- Make a method DisplayMinute which should display the total minutes in the Time. E.g.- (1 hr 2 min) should display 62 minutes


It is time for you to demonstrate your skills in a project of your own choice. You must DESIGN,
ANALYSE AND CODE any method for the GENERIC MyLinkedList class that will manipulate the linked
list. You can decide yourself what it should be following the specification below:
1. Purpose: The method must make logical sense à ƒ ¢ € “ it should be of some purpose to somebody.
You should describe in the text who will use the method for which purpose.
2. Clearly explain the problem. Then clearly explain how your method will solve it.
3. Test program: Test the method using a wrapped class like Integer however.

Write the pseudocode and flowchart for a vending machine


1. Write a program that generates a random number between 0 to 10. Use the following statements below for generating random number and the class Random from the package java.util:Random rand = new Random();int num = rand.nextInt(10);2. Display the generated random number with text: "The generated random number between 0 to 10 is: ".3. Name the class as RandomNumber and save the file.4. Compile and execute the program using the command prompt (cmd). If you do not have cmd, run it in JDoodle.

Using a switch statement, write a program that prompts the user for a numeric code and two operands. The numeric codes of 1, 2, 3, and 4 represents addition, subtraction, multiplication, and division respectively. Before division, your program should check whether the second operand is not zero. If it is, it should display “Division by zero not allowed” to the screen.

Sample Run1

Code: 1

Operand1: 5

Operand2: 4

Output1: Sum = 9

Sample Run 2

Code: 3

Operand1: 5

Operand2: 4

Output2: Product = 20

Sample Run 3

Code: 4

Operand1: 5

Operand2: 0

Output3: Division by zero not allowed



Create a do-while loop that asks the user to enter two numbers. The numbers should be added and the sum displayed. The loop should ask the user whether he or she wishes to perform the operation again. If so, the loop should repeat; otherwise it should terminate

Sample Run1

Enter two numbers: 3 15

Do you want another operation: Yes

Enter two numbers: 45 56

Do you want another operation: No

Output1: Sum = 119

Sample Run2

Enter two numbers: 33 150

Do you want another operation: Yes

Enter two numbers: -56 56

Do you want another operation: Yes

Enter two numbers: 58 15

Do you want another operation: Yes

Enter two numbers: 123 87

Do you want another operation: No

Output2: Sum = 466


  1. Printing triangles: Write a program which inputs a positive integer n and outputs an n line high triangle of '*' characters whose right-angle is in the bottom left corner. For example, if 5 is input the output should be

 

Sample Run1

Enter a positive integer5

Output1:

*

**

***

****

*****

 

Sample Run2

Enter a positive integer-36

Output1: The number entered is not positive

 

Sample Run3

Enter a positive integer10

Output1:

*

**

***

****

*****

******

*******

********

*********

**********


Using a for loop create a program that will prompts the user for two numbers and then print out a list of even number in between the two given numbers(inclusive), starting from the small number to the big number

Sample Run1

Enter two numbers: 1 10

Output1: 2 4 6 8 10

Sample Run2

Enter two numbers: 9 5

Output2: 6 8


Body Mass Index (BMI) is one of the criteria that is used to calculate whether one is fit or not basing on a person’s height (m) and weight (kg). The criterion is very simple; if one’s BMI is 25 or greater, it signifies overweight. A BMI less or equal to 18.5 indicates underweight. Lastly, a BMI greater than 30 shows obesity.

You have been requested to create a program that that helps the Namibian Defence Forces’ (NDF) Captain to calculates the BMI of a person (BMI = weight/height2) and also determine whether the person has also completed running 10 km in the required time. Men should complete 10km in less than 60 minutes for them to be accepted. Women should do that under 80 minutes. Both males and females are accepted if their BMI is less than 25 and greater than 18.5. For 2018 intake, there are already 6 males selected and 1 female. The values for gender, mass and weight are enter by user inputs


Create a do-while loop that asks the user to enter two numbers. The numbers should be added and the sum displayed. The loop should ask the user whether he or she wishes to perform the operation again. If so, the loop should repeat; otherwise it should terminate

Sample Run1

Enter two numbers: 3 15

Do you want another operation: Yes

Enter two numbers: 45 56

Do you want another operation: No

Output1: Sum = 119

Sample Run2

Enter two numbers: 33 150

Do you want another operation: Yes

Enter two numbers: -56 56

Do you want another operation: Yes

Enter two numbers: 58 15

Do you want another operation: Yes

Enter two numbers: 123 87

Do you want another operation: No

Output2: Sum = 466


LATEST TUTORIALS
APPROVED BY CLIENTS