Java | JSP | JSF Answers

Questions answered by 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

//write a method to receive two integer numbers and print the number which is nearer or equal to 20 if both number are more than 20, the method will print 0
public static void main (String [] argv)
{
nearer20 (10, 20); // Output : 20
nearer20 (18, 10); // Output : 18
nearer20 (10, 21); // Output : 10
nearer20 (30, 25); // Output : 0
}
public static void nearer20 (int n1, int n2)
{
continue

//write a method to received two integer arrays and copy the numbers in the first array repeatedly into second array
public static void main (String [] argv)
{
int []sample1 = {1, 2, 3};
int []sample2 = new int [7];
repeatCopy(sample1, sample2);
//sample2 will contain: 1 2 3 1 2 3 1
}
public static void repeatCopy (int [] data1, int[] data2)
Continue
Write an application that asks a user to type an even number to continue or to type 999 to stop. When the user types an even number, display the message “Good job!” and then ask for another input. When the user types an odd number, display an error message and then ask for another input. When the user types 999, end the program.
1- maxEvents(ArrayList<Student>): which receives array list of students and returns the name of the students who has maximum number of events.
2- sameMonth(Student s1, Student s2): which receives two objects of students and returns true if both of them have any events in the same month.
3- eventsMonth(ArrayList<Student>,int) which receives array list of students and an integer represents the month. It returns an integer represents how many students in the array list who have events at the received month.
Within the method main, call each dataOut method using an appropriate list of arguments chosen from four variables that are declared in main:
A char variable named letter, assigned the value 'a'
A String variable named name, assigned the value "Hello"
An int variable named number, assigned the value 5
A double variable named value, assigned the value 6.25
Be sure to include comments and display the results to the user.
Design a program that has five definitions of the method dataOut, with each one having a different signature. The signature for the five method definitions are
char, String, int, double
String, int, double, char
int, double
char, int
Design a program that has five definitions of the method dataOut, with each one having a different signature.
Design a program that asks the user to enter a floating-point number (either positive or negative). The program repeats while the user enters ‘y’ to continue. The program allows a user to enter either a lowercase or uppercase character. Use the ceil use the ( ), floor ( ), and abs ( ) methods to determine the smallest whole number that is greater than or equal to the number entered, the largest whole number that is less than or equal to the number entered, and the absolute value of the number given, respectively. Use the toLowercase ( ) method to change a given character value to lowercase if the value is an uppercase value.
Suppose a user wants to calculate the square of a number or the square root of a number, and display the results.
Prompt the user to enter a three word phrase as one string and then:

Display the number of characters (including spaces) in the phrase.
Display the number of characters in the middle word.
Display the final word in all upper case.
Write a program for Horizon Phones, a provider of cellular phone service. Prompt a user for maximum monthly values for talk minutes used, text messages sent, and gigabytes of data used, and then recommend the best plan for the customer's needs. A customer who needs fewer than 500 minutes of talk and no text or data should accept Plan A at $49 per month. A customer who needs fewer than 500 minutes of talk and any text messages should accept Plan B at $55 per month. A customer who needs 500 or more minutes of talk and no data should accept either plan C for up to 100 text messages at $61 per month or Plan D for 100 text messages or more at $70 per month. A customer who needs any data should accept Plan E for up to 2 gigabytes at $79 or Plan F for 2 gigabytes or more at $87.
LATEST TUTORIALS
APPROVED BY CLIENTS