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

Problem 2.
2.1.Make a program that allows you to create a 3 X 4 integer array. Your program will initialize the array with random numbers from 0 to 1000. Your program also will identify and display the largest value, smallest value, sum and average value of all data in the array.
Read a positive integer n. From 1 to n monitor the occurrence of 1. Your program should contain the method Monitor1. Include an option to repeat the process.

Sample Output
Enter the value of n: 15
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Total Occurrence of 1: 8

Try again Y/N?
1) write a method called larger that accepts two floating point parameters (of type double) and returns true if the first parameter is greater than the second, and false otherwise.

2)write a method called sumRange that accepts two integer parameters representing a range. Issue an error message and return zero if the second parameter is less than the first. Otherwise, the method should return the sum of the integers in the range, inclusive.
Write a main program class that instantiates a Deck and several Card
objects and calls each of their methods. The purpose of this class is to verify that
your supporting classes work correctly.
Use a one-dimensional array to solve the following problem: A company pays its salespeople on a commission basis. the salespeople receive $200 per week plus 9% of their gross sales for that week. For example, a salesperson who grosses $5000 in sales in a week receives $200 plus 9% of the $5000, or a total of $650. Write an application (using an array of counters) that determines how many of the salespeople earned salaries in each of the following ranges (assume that each salesperson's salary in truncated to an integer amount):
750, 1200, 5000, 7575, 10000, 9250, 12500, 3560, and 4800.
Write a program to echo the arguments given in the command line
A company accepts user orders by part numbers interactively. Users might make the following errors as they enter data:
• The part number is not numeric.
• The quantity is not numeric.
• The part number is too low (less than 0).
• The part number is too high (more than 999).
• The quantity ordered is too low (less than 1).
• The quantity ordered is too high (more than 5,000).
Create a class that stores an array of usable error messages; save the file as DataMessages.java. Create a DataException class; each object of this class will store one of the messages. Save the file asDataException.java. Create an application that prompts the user for a part number and quantity. Allow for the possibility of nonnumeric entries as well as out-of-range entries, and display the appropriate message when an error occurs. If no error occurs, display the message “Valid entry”. Save the program asPartAndQuantityEntry.java.
How do I convert a stringbuffer into a double in Java?
Hi All,
I use JSF and a4j and i have problem in a4j component as follow
- a4j component has action in backing bean that update some value
-aso has reRender attribute to reRender the component that displays this value(to display the new value)
- this behavior some times works fine but in other times after changing the value in bean by the action , the component in the page submitted the old value to the bean ,SO when reRender calls its getter it comes woth the old value ...

any suggestions ...
Please check the below Java code and highlight things that which is wrong in the code and could be improved. Please use Java-style comments (//).

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Collections;
import java.util.Date;
import java.util.Vector;

import org.apache.log4j.helpers.FileWatchdog;


/**
*
* Simple class that reads in a file - sorts its lines in natural order,
* writes it back out to the given filename and adds a timestamp of when it was sorted
*
* Program will be called with:
*
* java TestClass <input_filename> <output_filename>
*
*/
public class TestClass {


public static void main(String [] args) throws RuntimeException{
boolean OVERWRITE_FILE = true;
//get filename from args
String inputFilename = args[0];
String outputFilename = args[1];

//check usage
if(args.length != 2){
System.out.println("Incorrect
LATEST TUTORIALS
APPROVED BY CLIENTS