32,199 Topics
| |
import java.util.*; public class changemakerj { static Scanner console=new Scanner (System.in); static final double PRICE = 10.50; public static void main (String[] Args) { double quantity,tprice,amtpaid,change1,chg$10,chg$5,chg$2,chg50,chg20,chg5,chg2,chg1; System.out.println("Enter the quantity:"); quantity=console.nextInt(); System.out.printf("Total price:$ %.2f.%n",tprice=quantity*PRICE,quantity); System.out.println(); System.out.println("Amount paid:$"); amtpaid=console.nextDouble(); System.out.println(); ; System.out.printf("Change:$ %.2f.%n",change1=amtpaid-tprice,amtpaid); System.out.println(); chg$10=(int)(change1/10); change1=change1 - (chg$10*10); System.out.println((int)(chg$10)+ ":$10.00"); chg$5=(int)(change1/5); System.out.println((int)(chg$5) … | |
When I add buttons to a panel, the buttons seem to take a huge amount of space. How do I get rid of the space? For example: [CODE] import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Tester { public static void main(String[] args) { JButton dayButton = new JButton("Day"); JButton … | |
Good day House, im a good fan of this forum and needs assistance on info and what on aspect to expect on Sun Certified Java Administrator (SCJA) exam. Or perhaps, there maybe anyone with material that could be of great use for me. Thanks | |
ok i need a to make two simple programs from The first program can be a while , for , switch, or a do while loop 1) Output This progeam allows you to enter a list of positive integers(terminated by a -1) then displays the largest value, smallest value, and … | |
I'm not sure if this is possible, but I was wondering how you might get something in the menu bar, to the top right, where current user, battery power, airport signal, sound level are displayed. I think it might only be possible with Cocoa applications or something... I know with … | |
Ok, I looked in the API and was able to create the scroll bars. Problem is, I can't make them scroll, even though the parameters I passed in explicitly said to have the bars around. What I'm trying to do is to create a scrollpane around a JComponent object that … | |
Hello everybody, I just want to ask if what is the error on creating a jar file.. I am trying a create a jar file on my command prompt but it always flag an error saying 'jar' is an unrecognizable command... How can I fix this problem.. YOUR HELP IS … | |
Suppose I have a week that begins with Sunday and ends with Saturday (so UMTWThFS). How do I get the date for each day of the week if, lets say, we use this month and year? I looked in the API but I wasn't sure what to extract to make … | |
Hi Guys, I was trying to build a library catalogue with GUI (Graphic User Interface) which consists of two text boxes and four buttons. I have actually created the layout, but I dont know how to add actions to the buttons. Could anyone help me please. the Question is: for … | |
I have to somehow add a search function to my code. I have figured out how to add the search button and the text box next to it. The action event for the search button is currently the same as the event for the Next button. I need to change … | |
I attempt to create a string variable to a setter() that is used as query property What am I missing in the procedure to implement a simple query on the database? It stops here. [code] searchList1 = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : searchQuery1.getResultList(); [/code] [code] @Action public Task searchSplash() { if … | |
I already got this one... System.out.println("Hi!"); Thread.sleep(3000); System.out.println("How are you there!"); thnx for it!,... Although, I tried it using dialogbox., JOptionPane.showMessageDialog(null,"Hi!"); Thread.sleep(3000); JOptionPane.showMessageDialog(null,"How are you there!"); .,my question is... why Thread.sleep(3000); doesn't work during the proccess., is Thread.sleep(3000); limited only??? if not,how can I apply this one while using dialogbox.... … | |
can anyone help me with this one... System.out.println("Hi!"); System.out.println("How are you there!"); -can i display this one controlling the time! what i mean is.. display first the "Hi!" and then after 3 seconds it will display "How are you there!" Help me pls.. ANY HELP IS HIGHLY APPRECIATED -alpe | |
how can i write a program using JMF to perform video chat.That is people can see themselves while chatin on a LAN | |
I am doing one program which read serial port data (for bar code reader) using java application. y program is working well and reading serial data but it is not displaying special characters.When i read through hyperterminal i can see all special characters but when see data throught the output … | |
Dear all, Just got one more question. I tested in my java JMF program just now. I found that AVI and MOV format are supported by JMF. Whereas the WMA format is not supported at all. May I ask why it is so? Or is there anyother way to support … | |
I have several files and am receiving errors message when compiling and would appreciate any help. Thank you in advance. Model class file: [CODE]class Model extends Product5 { String genre; //add product to product inventory double restockFee; //fee for restocking //initialize constructor public Model( String genre, String name, int identificationNumber, … | |
there is a imformation when I write "javac Test.java" that is " Test.java uses or overrides a deprecated API. Recompile with -deprecation for details." yes,I want to see the detail,but how,how to do? for example ,I write like this:javac deprecation Test.java ,but fail,nothing display..... who can tell me how to … | |
Does java create an object in runtime or in compiletime ? Another Question : For embeded system [i.e. mobile phone] that have small memory, what happened if I created large number of objects ? Does JME [Java Micro Edition] uses Garbage Collector to free memory ? and how Virtual Machine … | |
Is there anything I can do to adj. searchList1 parameters? I noticed ?null: in the searchQuery1. What does this denote Thanks Steve query = java.beans.Beans.isDesignTime() ? null : entityManager.createQuery(resourceMap.getString("query.query")); // NOI18N list = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : org.jdesktop.observablecollections.ObservableCollections.observableList(query.getResultList()); searchList1 = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : searchQuery1.getResultList(); searchQuery1 = java.beans.Beans.isDesignTime() ? null … | |
Hi I have design a basic JFrame which displays three buttons in a frame. The code is given below: import java.awt.*; import javax.swing.*; public class PaymentFrame { public static void main(String[] args) { JFrame f = new JFrame("Payment Frame "); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setSize(800, 600); Container content = f.getContentPane(); content.setBackground(new Color(240,170,50)); content.setLayout(new … | |
how to pass input to an java program through keyboard. If java programe is compiled at editplus. | |
.,'is anyone knows how to open a new frame in java?help me pls. :'( ...i got difficulties with this one!! | |
I'm trying to create a program that counts and displays the number of times a specified character appears in a file I made. The file name is Test.txt, and says "this is a file I made to test this program." Here's what I've come up with, but it's not counting … | |
I am having trouble setting a query property for searchQuery1 I must be a return from a getter() (getSearchQuery()) Is it possible to set this query property using a return from a method? init: deps-jar: compile: run: [TopLink Info]: 2008.05.06 07:54:48.192--ServerSession(17548445)--TopLink, version: Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007)) … | |
In my GUI class I am trying to make an instace of my ToolAction class, which extends AbstractAction. The compiler says [QUOTE]The constructor ToolAction(String, int, PowerPaintDrawingPanel, GeneralPath) is undefined PowerPaintGUI.java line 109[/QUOTE] which means my below attempt make an object of ToolAction does not work beacuse the arguments of my … | |
Hi, I would like to ask if anyone knows how can I delete empty lines from a file. I thought that I have to crate a loop like [code] FileInputStream fstream = new FileInputStream("input.txt"); DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader (new InputStreamReader(in)); String strLine; while(br.readline()!=null) { … | |
.,'is any knows the code to delete a directory in java... help me pls... YOUR ANSWER IS HIGHLY APPRECIATED!.. | |
Using java and netbeans to write a query How does the (:) colon change this String? [ICODE]String partial=("SELECT c FROM content c WHERE c.artist LIKE \"%" + like + "%\""); String partial=("SELECT c FROM content c WHERE c.artist LIKE \"%" + :like + "%\"");[/ICODE] | |
Hello all! I am trying to create a form like structure using Swing to enter data into MySQL database. I have a combo box that has a list of items to be chosen. If the user does not find the option that he needs, he can choose 'Other' as an … |
The End.