32,204 Topics

Member Avatar for
Member Avatar for Ruben1123

[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 = …

Member Avatar for Aviras
0
162
Member Avatar for TigerTeck

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 …

Member Avatar for TigerTeck
0
167
Member Avatar for dennysimon

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

Member Avatar for dennysimon
0
186
Member Avatar for ali11

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 …

Member Avatar for NormR1
-1
217
Member Avatar for Jessurider

can anyone tell me how to make appear a jframe in a slow motion in java i'm using netbeans editor..............

Member Avatar for NormR1
0
412
Member Avatar for sike.mausa

[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[ ][ …

Member Avatar for sike.mausa
0
613
Member Avatar for limpek1991

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 …

Member Avatar for limpek1991
1
123
Member Avatar for subone

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 …

Member Avatar for JamesCherrill
0
3K
Member Avatar for <HHH>

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 …

Member Avatar for <HHH>
0
103
Member Avatar for shady05

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 …

Member Avatar for shady05
0
125
Member Avatar for BuhRock

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 …

Member Avatar for JamesCherrill
0
211
Member Avatar for StephNicolaou

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 …

Member Avatar for StephNicolaou
0
232
Member Avatar for sajithdil

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 = …

0
87
Member Avatar for angeriel1

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 …

Member Avatar for mKorbel
0
206
Member Avatar for tenlrt

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 …

Member Avatar for Slimmy
0
130
Member Avatar for codybuRr

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 …

Member Avatar for codybuRr
0
1K
Member Avatar for siva28

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.

-1
82
Member Avatar for TigerTeck

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 …

Member Avatar for TigerTeck
0
113
Member Avatar for Nandomo

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 …

Member Avatar for Nandomo
0
198
Member Avatar for Nandomo

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 …

Member Avatar for Nandomo
0
180
Member Avatar for akaicewolf

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? …

Member Avatar for hfx642
0
301
Member Avatar for federerforehand

[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 …

Member Avatar for hfx642
0
206
Member Avatar for lele07060

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 { …

Member Avatar for JamesCherrill
0
522
Member Avatar for eLu-sive

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= …

0
87
Member Avatar for skywire_

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 …

Member Avatar for mKorbel
0
2K
Member Avatar for domingur

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 …

Member Avatar for JeffGrigg
0
720
Member Avatar for Erlendftw

Is there an actionMap-like thing for mouse clicks? Thank you in advance, ive tried google, but did not find anything :/

Member Avatar for Erlendftw
0
207
Member Avatar for jjemphoung

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, …

0
159
Member Avatar for lele07060

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; } …

Member Avatar for JeffGrigg
0
80
Member Avatar for sha11e

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 …

Member Avatar for ~s.o.s~
0
208

The End.