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

Write a class Factors to model the factors of an integer1: • have attribute storing the integer whose factors are to be calculated. • have boolean array attribute ( factors ) where each element record whether that index is a factor of the integer i.e factor[5] = true • have a constructor which will assign the stored integer attribute to a user specified value and create the factors array NB: what is the size of this factors array? • have a method that calculates the factors of the stored integer and stores this is the Boolean array mentioned above. This is done by dividing the integer by all the integers less than itself and checking if there is a remainder. • have a method that prints out the factors of the stored integer to the screen i.e. “Factors of 120 are: 2, 3, 5, “ • have a method that takes another Factor object and prints out the common factors between that object the current object. • have a method that determines whether the integer is a perfect number by looking at the factors array.

What is the java program for this?


Passenger fare is classified according to the type of passenger. Senior Citizen enjoys 20%discount from the regular fare, Students get 10% discount. Regular passengers who do not qualified as neither Senior Citizen nor a Student should pay the regular fare of 150.

Write an algorithm that will accept details of five (5) passengers, including its name and

passenger type and will compute for the corresponding fare of each passenger. Display

the name and type of passenger, as well as the computer fare.


Passenger fare is classified according to the type of passenger. Senior Citizen enjoys 20%

discount from the regular fare, Students get 10% discount. Regular passengers who do

not qualified as neither Senior Citizen nor a Student should pay the regular fare of 150.

Write an algorithm that will accept details of five (5) passengers, including its name and

passenger type and will compute for the corresponding fare of each passenger. Display

the name and type of passenger, as well as the computer fare.


Write a multithreading program to get the maximum limit from the user to find the sum of odd and even numbers. Create a thread to find the even numbers from 1 to the maxlimit and get the summation. Similarly create another thread to find the odd numbers from 1 to maxlimit and get the summation. In the main thread the summation of both the odd sum and even sum should be calculated. 


Create a function in Java to count the number of embedded white spaces and

punctuations present in a text file named "Sample.txt".


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 = height/weight2) 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 


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


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.  


To qualify for an International Conference for Women in Computing (ICWC) next year in Toronto, Canada a student have got a distinction (a mark greater than 75) in PRG510S, be a female, and below the age of 25. Write a simple program that receives a mark, gender, and age from the keyboard and displays a corresponding message basing on the input.  


LATEST TUTORIALS
APPROVED BY CLIENTS