32,199 Topics
| |
I have to write a code that will print out the sum of all numbers between 1 and 100 that 7 and 5 go into evenly. I can't really think of how to write it. This is what I have but it doesn't work.[CODE] import java.io.*; public class work {public … | |
Yes, I've already checked the pinned thread, all of the suggested books there are for Core java Kindly post good books for J2EE thanks :) | |
Hi all, I am having trouble with class communication to reset some textfields through event handling. Any help would be appreciated. Here is a portion of my code. [B]The class that contains the textfields that I wish to use a reset button for:[/B] [CODE]import java.awt.*; import javax.swing.*; import javax.swing.border.*; public … | |
Hello..! I am newbie to java and I have got frustrated using notepad, can anyone please suggest me a good compiler for java. I am using Windows 7 as O.S. | |
Hello. I recently started studying Java and OOP. I am currently creating a class that writes text to a file in a particular format. I have 'finished' it, and it works, but I am unsure as to the quality of the implementation. This is how it works: * First of … | |
I have a two-d array from which I need to read values from any and all sides of each index. for example [CODE]int x=0, y=0; myArray [x - 1][y - 1];[/CODE] where x-1 and y-1 would be the values of the other end of the array. I've been up over … | |
A quantity known as the body mass index (BMI) is used to calculate the risk of weight-related health problems. BMI is computed by the formula BMI = w/(h/100)^2 Where w is weight in kilograms and h is height in centimeters. A BMI of about 20 to 25 is considered “normal.” … | |
I am having an error with my constructor, why is that? :| [CODE]public class Name{ private String firstName; private String middleName; private String lastName; public Name(){ this( "null" , "null" , "null"); } public Name(String first){ this(first," "," "); } public Name(String middle){ this(" ",middle," "); } public Name(String fName … | |
Im having problems with my code. :( the code should. the submenu for my menu should be on a radio button type. here's my first code: [CODE] public ... { //for background JMenuItem image = new JMenuItem("Images"); JMenuItem music = new JMenuItem("Music"); //submenu of music JRadioButtonMenuItem play = new JRadioButtonMenuItem("Play"); … | |
[CODE]/** * @(#)Car.java * *Chp.3 3.5 * @author Alec Ziff * @version 1.00 2011/9/23 */ public class Car { { public Car(double fuelEffciency) //all values are in miles per gallon { efficiency= fuelEfficiency; } public void addGas(double gas) { double newFuel= fuel + gas; fuel= newFuel; } public double drive( … | |
[CODE]public class CarTester { public static void main (String[] args) { Car myMysteryMachine = new Car (1000); // Car gets 1000 miles per gallon myMysteryMachine.addGas(20); // 20 gallons of gas are added to the tank myMysteryMachine.drive(100); // Driving the car 100 miles System.out.println(myMysteryMachine.getGasInTank()); // Method prints the remaining fuel } … | |
want to print Jframe like our word document. I have one jframe on jframe i have Jpanel ond on that panel i have j label . In jlabel i written a letter i want to print that letter so how can I print that letter. thank you | |
DiceRoller.java You are to write a program which will ask the user for the number and type of dice they would like to roll in the form of “xdy”. The x represents the number of dice, and the y represents how many sides the dice have. Your program MUST read … | |
Ok, I have this project In which I have to Write a Java program that can simulate a truck delivery, using the Java console as the exclusive input and output device. That is, each input to the TruckItem class, either unload or load an item (meaning creation of an object … | |
hey there, I am trying to build a small around soccer/football matches. So, I have built a class that models a Match (Match.java). It only contains field variables like hostid, guestid, matchid, result, and such, and setter and getter methods. When I retrieve matches from my sqlite database, I build … | |
I got a homework, its due by monday. I have read textbook a lot but i still dont know what to do next steps. Here is problem. The program should prompt the user for and accept two inputs: 1. The total price (including any applicable tax, etc.) for whatever was … | |
Dear friends , I am new to java . I created an JFrame(Calculator) application in Netbeans.Now i want to run that file from console(putty) since i gonna use that .java class in some other program through which i want invoke this . How do i do this . When i … | |
Problem 2. Create a new java file called Barcode.java that will check to see if a given barcode number is valid. Barcodes have a 12 digit number on them that is used to determine the validity of the code. This is done by summing the odd position digits (1,3,5,7,9 and … | |
guys, good day! I just want to ask how to reload/refresh a JComboBox. I have a cardlayout with 3 panels, each panel has its own combobox. what I want to do is to reload the combobox to its original state each time I swap the cardlayout. updateUI(); repaint(); revalidate(); I … | |
So I am trying to load a .png file for a very simple game. I have my all of my code saved in the directory: "C:\Users\Zach\Desktop\TestGame\source", and my image that I'm trying to load in a directory called "C:\Users\Zach\Desktop\TestGame\images". To load the image i am using [CODE]ImageIcon ii = new … | |
I have pretty much gotten my program to run with one little exception. It is asking for the SKU number which has been set but when I run the program it assigns a number to item and does not give me the sku number I had entered in the program. … | |
I'm searching for a good tutorial about object oriented analysis and design but can't find any short and clear tutorial which will has: 1. Explanation of oo concepts (very short) 2. CODE EXAMPLE (eg. if someone describe aggregation I wanna see how I can use this in my class) There … | |
I am just learning Java and am trying to use variables from objects that I passed into another method. Can someone help me here [CODE] package data; public class Data { private int day, month, year; public Data(int day, int month, int year) { this.day = day; this.month = month; … | |
Hey guys! I've created a simple program that given the current day and how many days from the current day, it will determine if it's a Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, where 1 Sun, 2 -Mon, 3-Tues, 4 -Wed, 5 -Thurs, 6 -Fri, 7-Sat My problem is that … | |
I had a problem.. when I call a frame which is a GUI and push a button which will be disabled.. and my problem was how should it retain the disabled button if the GUI was called again.. please help.. can you give an example.. | |
Write a program, when given an array of integers, it returns the biggest integer. Can you please tell me what's wrong in this program?? [CODE]import java.util.Scanner; public class Arrayint { public static void main(String[] args) { Scanner input = new Scanner(System.in); int i,index,max; int x; int[] list=new int[x]; max=list[0]; System.out.println("Enter … | |
Hi, does anyone know a free windows explorer type of project written in java? Basically i just want to implement a simple windows explorer but dont want to start from scratch with all the drag and drops and so on. Thanks | |
Hi, I am working to call java script function from java program. I am able to do with simple javascript functions like below: ScriptEngineManager factory = new ScriptEngineManager(); ScriptEngine engine = factory.getEngineByName("JavaScript"); engine.eval("function printHello(Str) { print('Hello World') } printHello('Hello World')"); But not able to do the javascript function which includes … | |
i am truly a beginner.please can anyone assume and help me define main method in this parameterized constructor programme [code]import java.io.*; class studentmarks { String name; double engmarks,phymarks,chemmarks; double tot,avg; public studentmarks(String s,double p,double e,double c) { name=s; engmarks=e; phymarks=p; chemmarks=c; } void compute() { tot=engmarks+phymarks+chemmarks; avg=tot/3; } void display() … | |
I am having problems figuring out how to get the results from the strings and then give myself the option to sort through them alphabetically (or numerically). I have the code to the point where it shows the input data but don't know where to go from there. I'm fairly … |
The End.