32,204 Topics
| |
[CODE]public class Order { private int widgets; private double price; public Order(double undiscountedUnitPrice) { price = undiscountedUnitPrice; widgets = 0; } public void addWidgets(int quantity) { widgets = widgets+quantity; } public double getTotalPrice() { return price*widgets; } public double getUnitDiscount() { if(widgets>10000) { if((widgets-10000)/1000>47.5) double toTakeOff = (((widgets-10000)/1000)*.10); price = … | |
Directions...Write a program SumOfOdds that has one main method that asks the user to input two odd integers where the first is smaller than the second. The program ouputs the sum of all the odd integers from the smaller output to the larger output. You must use a while loop … | |
hello all I have one textField and one textArea. How to move the cursor to the end of Text of TextArea when -cursor is in textField,and keyboard [Enter] pressed thank you denny | |
can someone help me to fix my codes.I am receving some errors.This is my first time i am using stack in GUI. [CODE]import java.util.Stack; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; import java.util.Scanner; public class CalcGUIPanel extends JPanel { //=============================================== instance variables //--\- Component referenced during execution private JTextField … | |
can anyone tell me how to make appear a jframe in a slow motion in java i'm using netbeans editor.............. | |
[B]I have been given a chunk of code from my teachers, and I just need help getting it to run. I'm very new to java so any help is much appreciated. Here it is:[/B] [code] import java.util.*; import java.io.*; public class CourseStats { static String[ ] studentNames; static int[ ][ … | |
Hi there. This is actually one of my assignment and i am having problem with the do while sentinel looping. The result i get is totally inverse from the one i expected. The system is supposingly ended when user enter 0, but it ended when user enter any value but … | |
Hi, I am making a program where the user has to input an integer with LESS than 5 digits. If he enters more than 5 digits, I want the program to print: "ERROR" How can I do that? I wrote this code till now. Do I have to use a … | |
hello ! im trying to read few numbers from a file and but each line of numbers in diffrent array now i can read the numbers but in one array any help here is the code [CODE] public static void main(String[] args) throws IOException { File number = new File … | |
i am creating an audio Player . I just wanted to implement this particular iTunes software feature i.e COVER FLOW , in which songs appears in thumbNails and with the help of left & right arrow keys we could scroll the playlist I was wondering if anyone could help me … | |
So I have to program this MVC GUI of a checkout line. I have a gui that has 10 registers. Each register has a queue of customers. There is a button that when clicked, will generate a customer and the customer will be entered in the line with the shorted … | |
Hey guys, I have an Jlabel class and trying to simply add it to the panel in my main class. However is nowhere to be seen! No errors are being output so currently have no idea what wrong...unless you can see whether my method is wrong... Jlabel class: [code] public … | |
Hi guys I have written a class that uses a frame and Swing components. Unfortunately the traversal policy that i wrote does not seem to work for the jmenu. Can u guys help me fox it....much appreciated [code] public class MainFrame extends JFrame { //<editor-fold defaultstate="collapsed" desc="Variables"> JMenuBar jmb = … | |
I have the folowing code so far which outputs the make and price of a car,but i cant seem to figure out were to add the discritpion of the car so that it can also be diplayed.HELP! i tried adding discription[k] = st.nextToken(); but the program did not run. [ICODE]import … | |
Hi, An urgent help is required. I need to display colored font in command prompt during execution of a java program on Windows Machine. I am unable to do so and while I searched for online help I came across JANSI library. Is there any other simpler and better way … | |
Hey All! New to here, but I have a couple questions: How do I find Average word length, and how to I printout the occurrence of each word size? Needs to look like this: [CODE]length frequency ------ --------- 1 3 2 13 3 24 4 13 5 10 6 2 … | |
Can you please tell us, free gold and silver rate service provider for RSS . And also give whether casting service provider RSS feed.. need java script above mentioned or XML file. | |
Directions...Write a program SumOfOdds that has one main method that asks the user to input two odd integers where the first is smaller than the second. The program ouputs the sum of all the odd integers from the smaller output to the larger output. You must use a while loop … | |
I am writing a program that gives and grades a test. Currently I am working on reading in the text from a file to administer the test, but am running into limitations. So I have a couple of questions. Is there any way I can read in a segment of … | |
I made an arraylist of objects which contain a question and an answer... How can I display just the question? Sooooo confused. Tutorials or anything will help, thanks in advance. [CODE] /* text file */ T Which Java keyword is used to define a subclass? extends S What is the … | |
Ok so I am writing this GUI menu and one of the choices on the menu requires the user to log in. So I open a new window that prompts the user for a username password. However after the user inputs the information how do I just close the window? … | |
[ICODE]import java.util.Random; public class Card { public String cardGeneration() { Random generator = new Random(); int x; // random integer representing suit int y; // random integer for card value String mysuit, mynumber; //assigning names, these will be changed int suits = 4, numbers = 13; //depending what card is … | |
can someone help me and tell me what is wrong, I can't figure it out. This is what it is exactly saying Lab424.java:14: cannot find symbol symbol : method printf(java.lang.String, float) location: class Lab424 printf(" sum %f\n", sum); it is pointing to the "p" [CODE]import java.util.Scanner; public class Lab424 { … | |
hi, am working on a bigger project than this, only using this as an example because i do not want to waste a lot of your time. i have this code, its supposed to write to the database, but have no idea as to what i should put under action= … | |
Hello, I was tasked to make a program that reads data from a text file and then place it into a JTable. I managed to read the file and split the strings but I don't know how to put the strings into a format accepted by JTable. Please help. This … | |
This is my project and I have the code below.....Create a class that simulates the functionality of a simple car. You can do simple things like drive, add gas and honk the horn. Simple text messages are displayed on the screen for feedback when appropriate and ALWAYS include the make … | |
Is there an actionMap-like thing for mouse clicks? Thank you in advance, ive tried google, but did not find anything :/ | |
I am currently doing some writings to an excel file (.xls) through JExcel API. My problem is about the autoSize method of CellView. My code. [CODE] public void write() throws IOException, WriteException { File file = new File(inputFile); WorkbookSettings wbSettings = new WorkbookSettings(); wbSettings.setLocale(new Locale("en", "EN")); WritableWorkbook workbook = Workbook.createWorkbook(file, … | |
can someone help me and tell me what is wrong, I can't figure it out. It is pointing to the line "public class Lab4.24" [CODE]import java.util.Scanner; public class Lab4.24 { public static void main(String[] args) { int i; float sum; i=3; sum=0; while(i<=99) { sum=sum + ( (i-2)/i); i=i+2; } … | |
I downloaded mysql-connector-java-5.1.18 and put it on my USB drive. I brought my USB drive to school and opened up Eclipse, in there I added an external .jar (the mysql-connector-java-5.1.18.jar). Then I wrote this java code: [CODE] import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.Scanner; public class Main … |
The End.