bluej

Im stuck on java programing [closed]

☆樱花仙子☆ 提交于 2019-12-13 08:55:07
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . i need to write method for the website class, called browserLogin, which allows a browser who already has an ID to log in to the site. This method is passed a Browser object as a parameter and which uses the browser's setLoginStatus method to "log in" that browser to the website. It also needs to outputs a

Getters, Setters and Constructors in Java - Making a car and stocking it

南笙酒味 提交于 2019-12-12 04:34:36
问题 I'm trying to create a class in Java using BlueJ. My class is named Automobile. My goal is to be able to use my Constructor method to create cars with the variables: year, color, brand, number of doors, number of kilometers, if it's automatic (boolean), if it's sold (boolean), a description, and an identification number. All the variables have a set default value, a minimum and a maximum accepted value. I have to use getVariablename and setVariablename for my methods. My color and brand

How to repaint over images in Java game

好久不见. 提交于 2019-12-12 01:55:37
问题 Hello everyone I am having trouble with painting over coins that the user intersects with. What I want this code to do is when the user sprite intersects with any of the ten coin images it paints over the coin so that it no longer appears on the screen (also need to add in some kind of counter so that when the user collects all ten coins it will stop the thread, and say "You Win!"). My question is how would I go about doing this because I have tried using repaint() in the if statements, and

Compiler says Java code is invalid

China☆狼群 提交于 2019-12-11 21:24:03
问题 I am working on a Java code: import java.util.Scanner; public class main { static Scanner console = new Scanner (System.in); public static void main (String aurgs[]) { System.out.print("Which function would you like to vist? L for Lottery, R for Random Math"); char lotto = 'l'; char rdm = 'b'; if (console.nextChar() = lotto) /**error is here*/ { lottery(); } } public static void lottery (String aurgs[]) { String announ = "Your lottery numbers for today are: "; System.out.print(announ); int []

Scanner doesn't work in Blue J (java)

岁酱吖の 提交于 2019-12-11 17:55:41
问题 So I have to create matrix of a certain size specified from the user. To do this I was using a Scanner and was going to take two int values, and use those to create the matrix. Long story short, when I ran it, it opened up the terminal window and said "Enter number: " just like I programmed it to, but it wouldn't let me enter a number. I investigated by making a simple program that should take in an integer and output that number, and the results were the same. Any suggestions? import java

Java Error: Invalid top level statement

情到浓时终转凉″ 提交于 2019-12-11 16:19:30
问题 I am having trouble running the following code. Not sure if I am doing this right, but I am trying to have the main method read two files that I am passing to the method as arguments. So in the interactions pane, I am typing: run Main(customer.dat, smartphone.dat) If I try to do this, I get an error: invalid top level statement I have attached the main method below. Where am I going awry? Even though the code compiles I have a feeling I am missing something with my readFile methods and/or

Method that takes user input

淺唱寂寞╮ 提交于 2019-12-11 07:41:52
问题 Hello everyone my name is Fyree, and I'm having problems with a school assignment where I need to create a method that takes the values from the user, and puts then through the computeRate() method to print out a line that shows the computed Rate. Since the program is taking the user input values as Strings, I am unable to use that in the compute rate formula since they are not ints. My problem is being able to convert the Strings into ints, and having the computeRate() be able to correctly

Constructor in class cannot be applied to given types. Hope for assistance

落爺英雄遲暮 提交于 2019-12-11 02:43:51
问题 I'm fairly new to Java and I'm using BlueJ . I keep getting the error: constructor ItemNotFound in class ItemNotFound cannot be applied to given types; required: int found: no arguments reason: actual and formal arguments lists differ in length I'm fairly confused and in turn not sure how to fix the problem. Hopefully someone can help me. Thank you in advance. Here is my class Catalog: public class Catalog { private Item[] list; private int size; // Construct an empty catalog with the

How can i use the lwjgl in bluej?

落花浮王杯 提交于 2019-12-10 12:09:57
问题 The lwjgl consists of two parts. I set up the java part by copying the "lwjgl.jar" into the "...\BlueJ\lib\userlib" folder and that worked. For the native part I have to point the java.library.path at the two DLLs "lwjgl.dll" and "OpenAL32.dll" . How do I do that? 回答1: LWJGL looks in a special variable to find its native libs. I don't know how blueJ works but you should do something like: System.setProperty("org.lwjgl.librarypath", new File("pathToNatives").getAbsolutePath()); More info and

Checking Password Code

三世轮回 提交于 2019-12-04 19:24:04
Problem Description: Some Websites impose certain rules for passwords. Write a method that checks whether a string is a valid password. Suppose the password rule is as follows: A password must have at least eight characters. A password consists of only letters and digits. A password must contain at least two digits. Write a program that prompts the user to enter a password and displays "valid password" if the rule is followed or "invalid password" otherwise. This is what I have so far: import java.util.*; import java.lang.String; import java.lang.Character; /** * @author CD * 12/2/2012 * This