Filters Java Programming - Determine If Integer Is Not Divisible By Some Value
Apr 10, 2014
I am new to java and do not understand how to use filters very well. I need to write a code that determines if an integer is not divisible by some value. A filter also contains an upstream filter so that this filter can be part of a chain of filters.
View Replies
ADVERTISEMENT
Sep 29, 2014
So I cant figure out why my output for my for loop isn't working properly. So the output for the square comes out right but the for loop isn't working properly for the H. I have tried to figure it out and it should go to the next line but its not.
import java.util.Scanner;
public class Random
{
public static void main(String [ ] args)
{
[Code] ....
Output
Enter a positive odd integer: 5
Square:
*****
* *
* *
* *
*****
H:
* *
View Replies
View Related
Jan 27, 2015
I have an endpoint that will determine if a passed in integer is prime or not. Should the request to this endpoint be GET or POST? Right now, I'm thinking it should be GET since it doesn't do anything to any resource.
View Replies
View Related
Apr 7, 2014
I have to make a program that determines whether an integer put in by the user is odd, divisble by 3 or divisble by 4..
import java.text.DecimalFormat;
import java.util.Scanner;
public class numbers {
public static void main (String[] args)
[Code] ....
I'm getting the error that div3 hasn't been initialized ... How do I even implement code to determine whether the number is divisible by 4 or 3?
View Replies
View Related
Apr 22, 2015
a. Write a Java program to input 10 integer numbers into an array named fmax and determine the maximum value entered. Your program should contain only one loop, and the maximum should be determined as array element values are being input. (Hint: Set the maximum equal to the first array element, which should be input before the loop used to input the remaining array values.)
b. Repeat 1a, keeping track of both the maximum element in the array and the index number for the maximum. After displaying the numbers, display these two messages:
The maximum value is: _________
This is element number __________ in the list of numbers
Have your program display the correct values in place of the underlines in the messages.
c. Repeat 1b, but have your program locate the minimum value of the data entered.
I did parts a and b but for part see i just want to know if i did it correctly or not
import java.util.Scanner;
public class MinimumValueArray {
public static void main(String[] args) {
//Variable Declaration
Scanner keyboard = new Scanner(System.in);
int size = 10;
[Code] ,.....
When I run it i get this The minimum value is 0.0
The element that holds the value is 0 right away. is this right for the minimum or am i supposed to enter values and it will display the minimum value like in parts a and b wit the maximum? will the minimum just always be 0 or ?
View Replies
View Related
Nov 13, 2014
I've been building out a course lab project over the last few weeks, and at the time (with what we knew), it made sense to use a session level ResourceBundle to facilitate translations.
In order to validate if there is a session level ResourceBundle, I have a filter running (checking if the bundle exists, creating one if not, etc...).
The problem I now have is the final step of the project (the part most recently taught), is to add Declarative Security.
Of course, when that happens the login.jsp is called and the Filter doesn't run. It's not a problem for most scenarios, except for someone who bookmarks a link inside the secure part of the site. Then, the ResourceBundle doesn't exist and the login.jsp content that should be translated is "".
Is there a way to indicate via the web.xml that a specific Filter should be allowed before the login.jsp is displayed?
I imagine JSTL:FMT is probably the best solution, but we don't cover that until after the lab is due. I have a (messy) short-term solution of creating a temporary ResourceBundle in the login.jsp via a scriplet if the session scope ResourceBundle is null, but I was wondering if I missed something with the web.xml.
View Replies
View Related
Apr 15, 2015
The goal is as follows: Write a UDP 'CompressionServer' that will take input from the user until it sees a "magic string" at which time it will create a compressed and uncompressed version of the file in the file system.
So, I need to integrate the following "Zip" code in to my UDP server code (which already creates the uncompressed file)... That is where I am stuck at now. My first few attempts had the Zip code after I write to "fout" but that failed to create a ZIP file.
I guess the main point here is what are the key pieces of the ZIP code that I should include and what would be the best spot to place them in my server code...
Zip Code:
import java.io.*;
import java.util.zip.*;
public class Zip {
static final int BUFFER = 2048;
public static void main (String argv[]) {
try {
String fileInput = argv[0];
String fileOutput = argv[1];
[Code] ....
View Replies
View Related
Apr 3, 2014
We are working with Java and Eclipse..One of the assignments asks to "Write an application that determines the number of coins in a jar and prints out the total in dollars and cents. Read integer values that represents the number of quarters, dimes, nickels and pennies. Use a currency formatter to print the output."
View Replies
View Related
May 1, 2014
I would like to bring a project in java program written by me, that interfaces with a fingerprint reader (already purchased, the reader U.are.U 4000b) and as I'm using fingerprint sdk sdk's Griaule.
View Replies
View Related
Feb 12, 2015
can we use java programming for image processing. if yes then how do we do it?
View Replies
View Related
Apr 7, 2014
I have written a java code to transfer files from one server to another using the concept of socket programming. I got the codes from another java forum that meet my requirements. The program is said to transfer large sized files (like .mkv , .mprg movies) from one machine to another and can be used to transfer files of all formats. But after running the codes I found that the program is not able to transfer large sized files such as movies and even pdf of sizes 80mb or 111mb. When i transfer small sized files, it gets transferred and the output shows that. You can run the codes and observe it. But when i try to transfer large sized files, the program goes on running for hours. The large sized files are not getting transferred. The program has used bytebuffer but still this error occurs. The codes are as follows (I got them from this site [URL] ....)
**ClientMain.java**
import java.io.IOException;
import java.net.Socket;
public class ClientMain
{
private DirectoryTxr transmitter = null;
Socket clientSocket = null;
[Code] .....
1. ClientMain.java and DirectoryTxr.java are the two classes under client application.
2. ServerMain.java and DirectoryRcr.java are the two classes under Server application.
3. run the ClientMain.java and ServerMain.java simultaneously
Also specify the source directory, destination directory and host address of the machine in which server is running in the ClientMain.java (as per your computer). Here we are not specifying source file, instead a source directory or folder is specifying. So the entire files of source directory will be transferred.
View Replies
View Related
Apr 4, 2014
1. Modify the following class so that the two instance variables are private, there is a constructor that accepts both the player's name and sport and there are get and a set methods for each instance variable:
public class Player {
String name;
String sport;
}
2. You can pass an instance of this class to the JLabel constructor if you want to display text in the label.Select one:
a. myLabel
b. myText
c. String
d. JTextField
e. JLabelText
how to start making this work?cause i am not familiar with the terms here and want to complete this program and I am new to java programming?
View Replies
View Related
Oct 13, 2014
I have written this program but I am seeing error when I compile this program ( javac TestArithmetic.java).
1)TestArithmetic.java:26 cannot find symbol
2)symbol: class Arithmetic
3)location: class TestArithmetic
4) Arithmetic ar = new Arithmetic(x1,x2,x3);
1)TestArithmetic.java:26 cannot find symbol
2)symbol: class Arithmetic
3)location: class TestArithmetic
4) Arithmetic ar = new Arithmetic(x1,x2,x3);
2 errors.
Code :
import java.util.*;
class TestArithmetic {
public static void main (String[] args){
float number;
Scanner console= new Scanner (System.in);
System.out.println("Enter first number");
[Code] .....
View Replies
View Related
Apr 8, 2014
I have written a java code to transfer files from one server to another using the concept of socket programming. I got the codes from another java forum that meet my requirements. The program is said to transfer large sized files (like .mkv , .mprg movies) from one machine to another and can be used to transfer files of all formats. But after running the codes I found that the program is not able to transfer large sized files such as movies and even pdf of sizes 80mb or 111mb. When i transfer small sized files, it gets transferred and the output shows that. You can run the codes and observe it. But when i try to transfer large sized files, the program goes on running for hours. The large sized files are not getting transferred. The program has used bytebuffer but still this error occurs. The codes are as follows (I got them from this site [URL] ....)
**ClientMain.java**
import java.io.IOException;
import java.net.Socket;
public class ClientMain
{
private DirectoryTxr transmitter = null;
Socket clientSocket = null;
[Code] ....
Note that:-
1. ClientMain.java and DirectoryTxr.java are the two classes under client application.
2. ServerMain.java and DirectoryRcr.java are the two classes under Server application.
3. run the ClientMain.java and ServerMain.java simultaneously
Also specify the source directory, destination directory and host address of the machine in which server is running in the ClientMain.java(as per your computer). Here we are not specifying source file ,instead a source directory or folder is specifying.So the entire files of source directory will be transferred.
View Replies
View Related
Jun 11, 2014
Remove the words that begin with two consonants.
View Replies
View Related
Jan 9, 2015
I am new to java programming and using bluej for programming and i have tried this question what i have have given in title ... how to find out the errors in the following program:-
class Primedig {
public void getinput(int n) {
int ctr=0;
while(n!=0) {
int r=n%10;
for(int i=1;i<=r;i++)
[code] .....
output:-
For example input is 243 the output comes only 3 not 2& 3 both.
View Replies
View Related
Jul 13, 2014
My interest in Java leads me to try and print numbers from 1-100. The output should show all numbers from 1-100 and each number that is divisible by by 13 should be replaced with a string "Fuzzy".
public class Fuzzy {
public static void main (String[]args){
for(int i = 0; i < 100; i++)
if(i % 13==0)
System.out.print(i + "fuzzy");
}
}
View Replies
View Related
Oct 30, 2014
Write a program to find the number of and sum of all integers greater than 100 and less than 200 that are divisible by 7.
View Replies
View Related
May 21, 2015
For some reason, the averages aren't calculating correctly. I'm aware I need to convert to double if I'm dividing by an odd amount but that itself isn't the issue. It's just simple easy divisible numbers that are not being calculated correctly. For instance, (10 + 10 + 10 + 50) / 4 = should be 2 but I get 10.
Here is the code:
import java.util.Scanner;
public class Avg {
public static void main(String[] args){
Scanner inputGains = new Scanner(System.in);
int userInput = inputGains.nextInt();
[Code] ....
View Replies
View Related
Aug 22, 2014
I am having problems with writing a simple program to see if a number is divisible by 6.
public void run() {
println("This program will display all numbers divisible by");
println(" 6 between 1 and 100.");
int x =1;
boolean divide =(x%6==0);
[Code] ....
It is telling that every number is not divisable by 6?
View Replies
View Related
Apr 4, 2015
I need to create a program in Java for below question
"Prompt user for three sides of triangle and determine if it is valid triangle and then compute area"
With code and Sudo Code for above question.
I am using Netbean compiler.
View Replies
View Related
Oct 12, 2014
I just started Java a few days ago and I'm having trouble with ActionListener..
Here are my codes so far , i'm having trouble with the
btnDetermineAction10686696_842067395825457_2521361553839739125_n.jpg:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class NumberAnalyzer extends JFrame{
private JButton btnDetermine, btnClear;
private JTextField txtNumber, txtFactors, txtPrime;
private JLabel lblNumber, lblFactors, lblPrime;
private JPanel pnlNumber, pnlNumber1,
[Code] ....
The output should be the one in the picture:
Input is placed at the NUMBER text field.
Identify its factors, write it at FACTORS text field.
Determine if it is prime. If prime, output at PRIME text field is “Yes”, “No” otherwise.
View Replies
View Related
Oct 9, 2014
i have to ask user gross sales until -1 sentinial and to get the commission to put in groups its 9% times the sales add $200
the groups are formatted
a) $200-299
/> $300-399
....
i) $1000 and over
import java.util.Scanner;
public class Commissions {
/**
* @param args
[Code]....
View Replies
View Related
Dec 18, 2014
I have to ask how many children's tickets you want to order. When I apply the code below, it just accepts whatever I input, including letters. I imagine it is to do with setting childrensTickets = 0? If I input a letter using the below it accepts - shouldn't it print the error given the input is not >=0?
System.out.print("How many children's tickets do you require? ");
int childrensTickets = 0;
boolean validChildrenValue = false;
while (validChildrenValue == false) {
if(aScanner.hasNextInt()) {
[Code] ....
View Replies
View Related
Feb 28, 2015
I am solving a problem in which first my program will ask a number N and then N numbers form the user
suppose:
5
4 3 4 5 6
another
6
3 2 7 8 9 3
and I am using this code
inputValues=new LinkedHashMap<Integer, Integer>();
Scanner in=new Scanner(System.in);
int N=in.nextInt();
String inputString=in.nextLine();
[Code] .....
But its not working as i want . Where is fault?
View Replies
View Related
Aug 10, 2014
public class MyInteger {
private int value;
public MyInteger(int number){
value = number;
System.out.println("Constructor created with value of " + value);
[code]....
I can't seem to get the value for integer1 and integer2 to pass with the setValue method. I get a runtime error stating the I need to have an int value for these two integers.
View Replies
View Related