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

Hi, i am pretty much a beginner programmer. I need to list out array items according to their max value down. It is a movie list where i need to list the movies according to the amount of views. I can calculate the one movie that has the most views with the following code.
public void mostWatchedMovies(Movie [] mList)
{
String print = "";
int watched = 0, mostWatched = 0;
for (int i = 0; i < total; i++)
{
watched = mList[i].getWatched();
if(watched>mostWatched)
{
mostWatched = watched;
}
print = "Most watched is "+mList[i].getTitle()+" watched "+mostWatched+" times";
}
JOptionPane.showMessageDialog(null, print);
}

The array is called mList, the getTitle and the getWatched are simply returning movie title and amount of views from a movie class.This works fine. I'm completely unfamiliar with arraylist and its sort methods so i want to do this with a normal array of movie objects. Could i use this most watched calculated in maybe for loop to countdown from most watched
write a Java program that sorts a sequence of numbers using two different algorithms: insertInOrder and bubbleSort.

input file 1 - 12 23 5 17 6 19 13 3 41 21 11 22 30 31 16
input file 2 - 58 120 121 69 138 171 36 175 31 115 104 22
Write an algorithm that is given your electric meter readings (in kilowatt-hours) at the beginning and end of each month of the year. The algorithm determines your annual cost of electricity on the basis of a charge of 6 cents per kilowatt-hour for the first 1,000 kilowatt-hours of each month and 8 cents per kilowatt-hour beyond 1,000. After printing out your total annual charge, the algorithm also determines whether you used less than 500 kilowatt- hours for the entire year and, if so, prints out a message thanking you for conserving electricity.
Can you guys plss help me on this problem,..I nid it A.S.A.P.


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.
I need a project in jsp,servlet for college/university website with backed ms-access.
Hi everyone,
I have to develop a concurrent program that provides an example of a concurrency implementation.
This program should be written in java.

who can help me in this assignment?
Hello, i have a question about java programming. Please help anyone..this is going to be on my test tomorrow.?

this is what i am using as my input file.
1) 67 23 49 27 51 57 55 12 10 3

2) 13 98 14 72 73 81 64 53 2 21 33 19 35 26 1

3) 99 88 77 66 55 44 33 22 11 12 23 34 45 56 67 78 89 91 21 32




private static void printArray( int array[], int cnt ); // print all values in the array on one line with a space after each number
private static void printAllBelow( int array[], int cnt, double ave ); // print all values that are less than the aveerage on one line
private static void printAllAbove( int array[], int cnt, double ave ); // print all values that are greater than the average on one line
private static int findMin( int array[], int cnt ) // return the smallest int in the array
private static int findMax( int array[], int cnt ) // return the largest
private static double findAve( int array[], int cnt ) // return the average

i know that to print all values of an array goes like this,

for( int i = 0; i< myArray.length; i++)
System.out.println( myArray[i]);
System.out.print(a
Write Java programs for each of the following. Compile, run and verify each
program. Appropriate comments, indentation and identifier names are expected.
1. Acoustic foam is a material used for sound insulation. It is manufactured by
pouring a latex-like material into a mold (similar to a waffle iron). Write a java
program which computes the volume of liguid
required to generate a sheet of this material.
Notice that a sheet has a base, (which you can
assume is 3cm thick), and a rectangular grid of
4-sided pyramids. Your program should input
the dimensions of the grid (pyramids across by
pyramids down), as well as the depth and width
of a pyramid. You can assume that the base of
each pyramid is a square and that all pyramids
on a sheet are of the same size. You can also
assume that there is no expansion or contraction
during the curing process.
Define a class called ‘twoInt’ with two public integer fields a and b
In the constructor of ‘twoInt’, initialize the a and b to be 1 and 2
Create an instance ‘mytwoInt’ in the main method
Write a method ‘swap’ (not the method of the class ‘twoInt’) and pass the above instance ‘mytwoInt’ into the method, swap two a and b in the method
Print out a and b in the main method
System.out.print(object.a + ‘ ‘ + object.b);
Swap(object);
System.out.print(object.a + ‘ ‘ + object.b);

my code
public class TwoInt
{
public static void main (String [] args)
{
int a;
int b;

TwoInt myTwoInt = new TwoInt();

System.out.println(myTwoInt.a + " " + myTwoInt.b);

}

public TwoInt()
{
a = 1;
b = 2;
}

public void swap (myTwoInt int a, int b)
{
int tmp = a;

a = b;
b = tmp;

System.out.println(myTwoInt.a + " " + myTwoInt.b);

}
this is my javascript code how to validate


<-----this is my java script--------->

<!-------this is my form validation------->

function validateForm(theForm)
{
var errReport = "";
errReport += validUsername(theForm.username);
if (errReport != "")
{
alert("The was a problem with the following field(s):\n" + errReport);
return false;
}
return true;
}
//form validation close //

//valid username //
function validUsername(fld)
{
var error = "";
var valid = /^[a-zA-Z0-9]+$/;
if (fld.value == "")
{
fld.style.borderColor = '#ff0000';
document.getElementById('username').style
LATEST TUTORIALS
APPROVED BY CLIENTS