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

import java.util.Scanner;

public class NetbeanTest{
public static void main(String[] args) {
Scanner console = new Scanner(System.in);
System.out.print("Enter Operator (+,-,*,/): ");
String plan = console.nextLine();
System.out.print("Enter Value 1: ");
int num1 = console.nextInt();
System.out.print("Enter Value 2: ");
int num2 = console.nextInt();
int result;

if (plan.equals(" + ")) result = num1 + num2; {
System.out.println("Result of " + num1 + " + " + num2 + " = " + result);}
if (plan.equals(" - ")) result = num1 - num2; {
System.out.println("Result of " + num1 + " - " + num2 + " = " + result);}
if (plan.equals(" * ")) result = num1 * num2; {
System.out.println("Result of " + num1 + " * " + num2 + " = " + result); }
if (plan.equals(" / ")) result = num1 / num2; {
System.out.println("Result of " + num1 + " / " + num2 + " = " + result);}
}}
// What went wrong?//
Write a servlet that lets a user vote for his favorite food from a combo box or radio buttons (the user must able to make multiple food selection per request)
Write a program called TriangleChecker that has the following specification:

a. Accept three command line arguments that can give integer data values. These arguments represent the lengths if the sides of a triangle.

b.Check whether the 3 values can be the sides of a triangle. A triangle will not be possible if the sum of any two is less than or equal to the third.
My question is.
Write a program to perform the following experiment: Generate 100 random numbers. As each number is generated, insert it into an initially empty binary search tree. When all 100 numbers have been inserted, print the level of the leaf with the largest level and the level of the leaf with the smallest level. Repeat this process 50 times. Print out a table with a count of how many of the 50 runs resulted in a difference between the maximum and minimum leaf level of 0, 1, 2, 3, and so on.
Write a Servlet that takes the user’s name and age from a form.
• Echo back the name and age along with a message stating the price of movie tickets.

• The price is determined by the age passed to the JSP.

• If the age is greater than 62, the movie ticket price is $7.00.

• If the user is less than 10 years old, the price is $5.00.

• For everyone else, the price is $9.50.
I wrote a Java Beans program while compiling it I got an error saying that
"your class bean is public and need to be declared in a file named bean.java ".
Can you solve my problem how to eliminate this error?
Write a program to perform the following experiment: Generate 100 random numbers. As each number is generated, insert it into an initially empty binary search tree. When all 100 numbers have been inserted, print the level of the leaf with the largest level and the level of the leaf with the smallest level. Repeat this process 50 times. Print out a table with a count of how many of the 50 runs resulted in a difference between the maximum and minimum leaf level of 0, 1, 2, 3, and so on.
Write a Java program that reads in a positive integer representing time in seconds and converts it to hour, minute and seconds. for example, if the inputs is 3670 seconds, it works out to be 1 hour, 1 minute and 10 seconds.
Write a JSP that takes the user’s name and age from a form.
Echo back the name and age along with a message stating the price of movie tickets.
The price is determined by the age passed to the JSP.
If the age is greater than 62, the movie ticket price is $7.00.
If the user is less than 10 years old, the price is $5.00.
For everyone else, the price is $9.50.
Write a servlet that lets a user vote for his favorite food from a combo box or radio buttons (the user must be able to make muliple food selections per request).
Store the favorite foods and the number of votes for each food.
Display all foods and their number of votes in alphabetical order back to the user.
Use an appropriate Collection class or Map class to store the data.
LATEST TUTORIALS
APPROVED BY CLIENTS