32,199 Topics
| |
[CODE]import static java.lang.System.*; public class ShipTester { public static void main (String []args) { Ship s1 = new Ship(); s1.setX(3); s1.setY(10); s1.setSPeed(22); out.println(s1.getX()); out.println(s1.getY()); out.println(s1.getSpeed()); out.println(s1);//calls the ToString method Ship s2 = new Ship (3,10, 22); ship s3 = new Ship(5,7 ); s3.setSpeed(19); out.println(s1.equals(s2));//s2 becomes rhs out.println(s1.equals(s3));//s3 becomes rhs } … | |
| Hi, it is kind of a beginner's question... I'm trying to read user's input from keyboard. The user types in: a1 a2 a3 b1 b2 b3 c1 c2 c3 ... in which each line has three integers separated by a space. Every three integers are on the same line. [CODE]Scanner … |
it's my homework and i have no clue what i'm doing. i pay attention in class but i still don't know what's going on! it's a 2 part project, with a cointoss class and histogram class. this is my cointoss class [CODE]import java.util.Scanner; public class CoinToss { private static final … | |
hellow, i wondering will be able to draw a pi chart with diffrent scetions colored diffrently with out using Graphics2d class....in addition that i want to make it rotating 360 degree.:icon_neutral: | |
Hi all, I have a serious problem, I made a program in java that prints reports, I made and tested the reports with one printer, but when I used the program in another printer (and another pc) all the fields are printed around 5mm down of the normal position. I … | |
so we have a big project and i already did the cartesianproduct portion now i'm stuck on creating a venn diagram application that should ask for the user to enter specifications like labels dancing singing , etc. and then how many for each 23 students like dancing, 10 like singing … | |
I am a very new java student.I need to write a program ask the users to enter the series numbers separated by commas, with the valid input is : 23,45,90,4,5 The program should calculate and display the sume of all the numbers. I had written the code. I knew it … | |
[CODE] Film[] callFilms = new Film[100]; static int numberFilm = 0; [/CODE] [CODE] //Search Film Method public static void searchFilm(Film[] callFilms){ Scanner scan = new Scanner(System.in); int condition = JOptionPane.YES_OPTION; boolean check = true; do{ System.out.println(); System.out.println("Search Films"); System.out.println("============"); System.out.print("Please Key-in Item Code: "); String code = scan.nextLine(); for(int i … | |
Is it possible to create an array of functions in Java? Or is this not possible? | |
Hello all, I'm using the version 6 of Eclipse JAVA development. The code below is very basic, but I'm getting warnings which is probably preventing me from running the application. Any ideas? Basically what I'm designing is a program which would input the radius and therefore it would display the … | |
Dear all, When printing a grid, for example a chess board, I was hoping it wouldn't have the same output as the console. When I want the position to be grid[x][y] = 5, 5, it will place the counter in the bottom right corner in a 5x5 grid, (5,1) instead … | |
| |
I was writing a code for class as follows: [CODE]import java.util.Scanner; public class Salary2 { public static void main(String[] args) { Scanner input=new Scanner(System.in); String name; float salary; float hours; System.out.print("What is the employees name?"); name=input.nextLine(); while (!name.equals("stop")) { System.out.printf("What is %ss salary per hour?", name); salary=input.nextFloat(); System.out.printf("How many hours … | |
Hi all, I am having confusion on polymorphism 1)Is Method Overloading considered as polymorphism? 2)Is there two types of polymorphism(run time and compile time ) available? thanks in advance | |
Hi, I have this requirement that I have been trying to solve for a couple of days now. I have this source DB. The objective is to extract data from this source DB and insert into a oracle table. The meta data for both tables are the same (1-1 mapping). … | |
Hello, I've been trying to code a TrueSkill calculator using Java that fetches scores and updates them in a MySQL database. I finished coding it however it appears to have a problem while executing. This is an example of what I want the output to be like: [QUOTE]connecting to database … | |
film class [CODE] import java.util.Scanner; // Creating Class Members public class film { private String itemCode; private String title; private String description; private String language; private String runningTime; private String productionCompany; private String status; //eg, pending, premiering, running, written-off // No-argument Constructor: Without Parameters public film() { itemCode = ""; … | |
Hi, I'm making a snake game and I got a timer to check everything and repaint the component. How can I achieve a 60 fps without affecting the movement of the snake. I need help to come up with an equation for the speed of the snake. Need to change … | |
Hi there, I have to create a card game as an assignment, and i am having trouble with a part of the assignment. Basically, there is an array, 'playerHand', which holds a set of integers. What i want to do is to add the elements of the array and then … | |
Hey, I am now programming in a MacBook Pro and for the KeyCodes in the Robot Class, there is no set key for Command. Can I set a KeyCode to do the actions of the Command key? Thanks | |
Hi i am new to java gui, i have trouble using color constructor. please tell me what the problem . thank you . [CODE]import java.applet.*; import java.awt.*; public class AnAppletSubclass1c extends Applet { Color c = new Color(5,25,205); public void Color(int r,int g,int b); public void init() { System.err.println("Hello from … | |
I need help understanding this algorithm Design a variation of algorithm TreeSearch for performing the operation findAl(k) in an ordered dictionary implemented with a binary search tree T, and show that it runs in time O(h + s), where h is the height of T and s is the size … | |
Your task is to implement Stack and Queue classes for Objects. Both Stack and Queue should extend Collection, which is an abstract class that will be given to you. You will need to download and modify the NetBeans project that goes along with this assignment. Stack should have the following … | |
Write a java project (applet) that has two classes. The driver class (has the init() method) should allow the user to enter into an Input Dialog Box, the mail type ("P" for Priority or "F" for First Class), a blank space, and the weight in ounces of the piece of … | |
First of all, hello Im Joey and Ive recently started messing around with the Java language. Ill do my best not to bother you alot with my newbie questions :) So I need to create a method that returns some variables I have encapsulated, as String but without the last … | |
| I need help trying to figure out what I am doing wrong. my teachers wants two different sentences to read as "Wow, (insert word 1) and (Insert word 2) are funny" and on the second line he wants them reversed to read "Wow, (insert Word 2) and (Insert Word 1) … |
I have written a solution to the following assignment but I wont get any output. I used System.out.println randomly to see where my program stops and I figured out it is righ after the while (inputFile.hasNext()) method. Any suggestion will be great. Thanks! my assignment: build a program that uses … | |
[CODE] //Member Login public static boolean memberLogin(){ int memberPassword = 123; boolean password = false; int confirm = JOptionPane.showConfirmDialog(null, "Are You A Member? ", "Member Confirmation", JOptionPane.YES_NO_OPTION); do{ while(confirm == JOptionPane.YES_OPTION && password == false){ String tempCurrentPassword = JOptionPane.showInputDialog(null, "Please Enter Your Password", "Default Password = 123"); int currentPassword = … | |
Hi - I'm having a hard time figured out how to print the triangle shape below using loops. I did the two previous triangles with no issue but have no idea how to get the spaces in there. I'm really confused and would appreciate any help. [CODE] * ** *** … | |
So this is my assignment: Represent the concept of a Number. For this example a Number is a thing that can be added subtracted, multiplied and divided. Each of these operations is binary and produces a Number as a result. Encode the the Notion of of an Int (an integer … |
The End.