We have an application running successfully where we fetch the weight of product currently on Production Line using Java.
All the products on line belong to same order and are of same type.
User at beginning enter the type of product and starts the production line.
Proposed new process: Now client want that multiple type of product can belong to same production order. i.e. on a production line different type of products can come one after other. So we should now fetch the type of product also.
The Question : what are different possibilities in which we can find the type of product. Can java fetch color of a box ? If we use scanner on line that scans the product and sends the color information to Java.
Above is just a possibility. Can there be any other parameters that Java can use to differentiate in type of product ?
Currently we are clueless. What ever are the possibilities in Java we can propose the same to client. Even if that requires additional hardware.
public class InputFileData { /** * @param inputFile a file giving the data for an electronic * equipment supplier’s product range * @return an array of product details * @throws IOException */ public static Product [] readProductDataFile(File inputFile) throws IOException{ // YOUR CODE HERE }
This code is meant to be used to read a text file and store the data in an array of type Product[]. I know how to read in a text file and have it sort it into an array, but I've never seen code laid out in this fashion before (specifically "public static Product[]", and I'm unsure how to work with "(File inputfile)". I've looked all over the place but can't find any examples of anything like this.
Also, the code given cannot be changed, as it's that code I have to work with.
I still don't understand how to use it as a whole. For example, do I read the file in the main and have this method read that in and output to the Product class? Do I read the file in this method? I can't work out how to make this work when I have to use this method.
I am developing in Android Studio and I made a simple background, the actual resolution of the image is 1440 by 2560. I made it that resolution so, 1, it is easier to scale down than up, and 2, in android studio i use a nexus 6 as my preview. When I plugged in my gs4, not a 1440 by 2560 display, the background wouldn't show up when I ran it on my gs4(galaxy s 4). How do i get my background to scale and display on any display size.
I'm having trouble creating a highly efficient algorithm for counting within a custom scale. This problem applies to futures trading, specifically treasuries contracts.
One specific treasury contract has 32 units before rolling over to the next whole number. So, the price scale looks something like this ...
If I pick a number (price) at random, let's say 1 28, and I want to add 8 units to that value, I should end up with 2 4. I can do this using brute force, calculating remainders, etc, etc....
I'm trying to figure out how to print the Major Scale of any give note in music. It works as follows:
There are 12 notes and each note is assigned a number
C = 0, C# = 1, D = 2, D# = 3, E = 4, F = 5, F# = 6, G = 7, G# = 8, A = 9, Bb = 10, B = 11.
After picking a random note, say F, the idea is to add the following sequence to move through the scale:
0, +2, +2, +1, +2, +2, +2, +1.
So, with F being 5, we move through the scale as 5, 7, 9, 10, 0, 2, 4, 5.
The theory is unimportant but, as you can see, the sequence loops back on itself, rather than continue past 11. This is where I'm stuck, though. I'm not clear on how to loop my numbers around in code. I'll show my attempt here:
public static void main(String[] scale) { majorScaleOf(0); //0 represents C!! majorScaleOf(5); //5 represents F!! majorScaleOf(10); //Bb = B flat!!
[Code] ....
For the sake of simplicity I haven't shown the entire script of 'if' statements, but you get the idea.
The print out reads as:
0, 2, 4 (For C) 5, 7, 9 (For F) 10 (For Bb)
The last line demonstrates the problem, as I need it read as 10, 0, 2.
I've tried different approaches, but wanted to convey the basic problem with this post.
I am new to programming, but am working on a program that takes 6 inputted grade averages on a scale of 0.0 - 100.0 (exceptions in the case someone has exceeded the traditional 100.0 limit) and then divides it by 6 and returns the value in a dialog box. However, I want to take the values inputted and convert them to a 4.0 scale (90.0-100.0 = 4.0, 80.0-89.99 = 3.0, etc.) and then get the average of that so that I can return an average on a 4.0 scale. I have been trying to accomplish. Also, as of right now my program only prompts the user for 6 inputs, but I'd like the user to be able to input as many as he/she would like to, I am pasting the code I currently have below.
import javax.swing.JOptionPane; public class GPA_Calculation1_0 { public static void main(String[] args) { String courseOne = JOptionPane.showInputDialog("Enter numeric GPA of Course One: ");//Course one double numOne = Double.parseDouble(courseOne);
So I have scale, and you can change it, like I print out a bufferedimage read by imageio from a file, can I enlarge it by 2x, because my tiles are too small eventhough they're 16x16, should I decided to decrease my tile grid from 40 to 20, but instead change the scale by 2. Can I enlarge the image as it is put on the screen?
I implemented the gray scale filter and the convolution filter . If I apply before the grayscale filter convolution and then I can not see the picture, I see pretty much the JPanel that should contain the image. The two filters separately functioning correctly
Code filter grey scale
public BufferedImage greyScale(BufferedImage originalImage) { BufferedImage destImg = new BufferedImage(originalImage.getWidth(), originalImage.getHeight(), BufferedImage.TYPE_INT_ARGB); int alpha, red, green, blue; for (int x = 0; x < originalImage.getWidth(); x++) { for (int y = 0; y < originalImage.getHeight(); y++) { int pixel = originalImage.getRGB(x, y);
If I change the servlet and have "request.getRequestDispatcher("/pages/ViewCompletedWWDocs.jsp").forward(request, response);" un commented, I get exception "java.lang.IllegalStateException: Cannot forward a response that is already committed".
The program contains username and password which on submission checks with the database if the details entered are right or wrong....on right details it Displays Welcome (name) and (lastname) parameters from database.
I am developing my college's project in JSP using jquery to open a magnific popup when user clicks on a link and the in the magnific Popup must be fetched from Mysql and i tried two approaches for this:
1. magnific Popup type is ajax here i passed the variable value in the link of href (after '?') to another JSP page where connection to database is created and queries are written in JSTL to fetch data and show this in magnific Popup .. But i failed in this approach, don't know in another JSP page the data without having database connection is loaded in the magnific Popup easily but not database data..
2. magnific Popup type inline here i need to pass the variable value in the same page between different tags..
I have the following code Java (is it just a meaningless example ), my question is: if I wanted to insert a code to multiply two fraction into moltiplicaPer() metod What should I write?
public class Frazione { private int num; private int den; Frazione() { num = 0; den = 1;
If there are 4 values in underlyingTickersList A, B C, D and E ... I am getting those values correctly displayed in each text field.
However if I submit the form with all these value how can I get it in the bean? I guess I need to have dynamic id or name for each text field. How can generate it?
Note** I dont have Struts framework.. I am using request.getParameter to fetch the values and set into the bean variable.
I'm having an issue, I have a scanner (Scan.nextLine();) that scans the console for input to fetch the string "word". Then I want to fetch a character using Scan.findInLine(word).charAt(number);. The problem is that the console requires me to write 2 lines in order for the program to move on. I only want the program to scan for a word, and then move on with what it has instead of requiring 2 inputs.
I have to fetch only the book name attribute and use it for display .However say for example ,I have got the list of Books ie(C#,Oracle,Archius) ,passing this value to a method should return me an array of URL nodes value within it.
The idea is to display the book names in a list and then on user selection , corresponding URL needs to be fetched.
Was able to get the loop for traversing the nodes
[java=code] NodeList nodeList = document.getDocumentElement().getElementsByTagName ("Book"); for (int i = 0; i < nodeList.getLength(); i++) {... [java=code]
So
a) Display the BookNames
b) Get the corresponding URL's for the particular book if I pass the Bookname
I am not sure what is happening with my code, but it is giving me a negative number. I am trying to write a program that calculates the product of the odd integers between 1 and 25. I messed with the program and as soon as you enter a number over 22, the end result is a negative number.
int total = 1; for (int i = 1; i <= 25; i += 2){ total *= i; } System.out.println("Product:" + total);
The question is when you send two messages from the client to the server does the server read the messages as one input or do you have to read both inputs on the server side?
Im using DataInputStream and DataOutputStream
On the client side I send two messages one for the database action to be performed and the send is the information needed to get the job done.
Example I want to search for a product in the database.
I send to the server an output message saying search product. I then send to the server which product I want to be searched.
The server then retrieves the message by in.readUTF(); switch statement determines what database action should be performed. Within that case I call another in.readUTF() to pass the information to the database on what product to search for.
Would this work or would the server read both messages from the client as one input stream?
I am working on the following simple question of Java: "Write a program called Product1ToN to compute the product of integers 1 to 10 (i.e., 1,2,3...10). Try computing the product from 1 to 11, 1 to 12, 1 to 13 and 1 to 14. Write down the product obtained and explain the results."
public class HelloWorldApp { public static void main(String[] args) { int lowerBound = 1; int upperBound = 10; int product = 1;
I wanted to know if I was off to the right start. I am trying to write a program using the for loop the calculate the product of the consecutive numbers 4 through 8 but so for I am getting 3 values output and I only want 1 value at the print out.
The code I am using outputs the numbers too large. I am trying to see where I went wrong.
for ( int i = 4 ; i <= 8; i++) { int j = i++; int k = j++; int l = k++; int m = l++; System.out.println( + (i*j*k*l*m) ); }
What I am trying to do here is allow input to loop until 0 is entered for the product number. When 0 is entered, it should then dump the total for each individual product. I've tried it about a dozen different ways and have yet to be able to get the loop to function as intended. The way I have the code below, the loop will not function at all (where as before it looped, but never finished).
import java.util.Scanner; public class Sales { public static void main(String[] args) { double total1=0.0; double total2=0.0; double total3=0.0; double total4=0.0; double total5=0.0; int product;
My problem is that in my program, I have the user input data for one of three product objects, however when I read the data for all three objects, the same data is stored in all of them.
Anyway this is the method from the Interface class:
private void readInput() // the only method in the program that accepts product data from the user { Store matesStore = new Store(); String name; int demandRate, productChoice; double setupCost, unitCost, inventoryCost, sellingPrice; Scanner console = new Scanner(System.in);
[Code] ....
And here is the method from the Store class:
public static void addData(int option, String newName, int newDemand, double newSetup, double newUnit, double newInventory, double newPrice) //sets the product data for a particular product { if (option==1) setData(product1, newName, newDemand, newSetup, newUnit, newInventory, newPrice); else if (option==2) setData(product2, newName, newDemand, newSetup, newUnit, newInventory, newPrice); else /*(option==3)*/ setData(product3, newName, newDemand, newSetup, newUnit, newInventory, newPrice);
[Code] ....
The problem I had was with static variables and methods.