bluej

Overriding User Library Classes in Java

不羁岁月 提交于 2019-12-04 18:13:36
I code java with BlueJ for Mac. I have added the stdlib.jar library (From princeton http://introcs.cs.princeton.edu/java/stdlib/ ). Before added this library I had my own class named StdDraw.java (The specific class I was using on the project) and copy/pasted the code. I also adjusted some of the code and added some new lines. Since I cannot edit the libraries code, how may I override or extend library classes to add additional functionality? Since the library classes are final , you can't extend them. Another option is to wrap them in your own classes. For example, you can create your own

Java nested loops

十年热恋 提交于 2019-12-04 07:15:29
问题 Program Description: Write a program to print 21 rows of X's in the shape of a large X as illustrated below. Be sure so the two rows intersect at the "11" row. Here is what I want as an output: Here is what I have so far. public class Program168h { public static void main (String [] args) { String d= "X"; for (int a = 1; a < 23; a++) { for (int b = a; b >= 1; b--) { System.out.print(" "); } System.out.print(d); for (int x = a; x < 22; x++) { System.out.print(" "); } System.out.print(d);

int cannot be converted to int []

五迷三道 提交于 2019-12-03 00:25:40
问题 new to programming here and i keep getting the error message, 'incompatible types, int cannot be converted to int []', the question is to add R1& R2 together if they are of equal lengths and if not print a message that says 'the arrays must be same length', if that matters, not sure where im going wrong, any help would be greatly appreciated public int[] arrayAdd(int[] R1, int[] R2) { int[] sumArray= new int[R1.length]; if( R1.length!= R2.length) { System.out.println("The arrays must be same

eclipse plugin for bluej interface [closed]

给你一囗甜甜゛ 提交于 2019-12-02 20:40:23
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . Is there an Eclipse plugin that allows us to see the classes and objects like BlueJ does ? I find it way more easier to create an

while loop not ending when required

房东的猫 提交于 2019-12-02 18:46:41
问题 So some background information, I'm new to programming and am still learning, so I apologize for my trivial error making. I am making my own text based game just to further practice etc. Here is the link to everything on dropbox for more context: https://www.dropbox.com/sh/uxy7vafzt3fwikf/B-FQ3VXfsR I am currently trying to implement the combat system for my game, and I am running into the issue of the combat sequence not ending when required. The 'combat sequence' is a while loop as follows:

Java variable might not have been initialized? [closed]

谁说胖子不能爱 提交于 2019-12-02 17:52:36
问题 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 6 years ago . My BlueJ IDE is showing this error when I try to compile the class. I can't see what I'm doing wrong. 回答1: Before you can use a variable inside your if

int cannot be converted to int []

折月煮酒 提交于 2019-12-02 13:59:06
new to programming here and i keep getting the error message, 'incompatible types, int cannot be converted to int []', the question is to add R1& R2 together if they are of equal lengths and if not print a message that says 'the arrays must be same length', if that matters, not sure where im going wrong, any help would be greatly appreciated public int[] arrayAdd(int[] R1, int[] R2) { int[] sumArray= new int[R1.length]; if( R1.length!= R2.length) { System.out.println("The arrays must be same length"); } else { for(int i=0; i< R1.length; i++) for (int j=0; j<R2.length; j++) { sumArray= R1[i]+

Method parameter mismatch: Required double, no argument passed

为君一笑 提交于 2019-12-02 13:26:39
I am almost complete but when I compile I get the error "Method getUserTax in class IncomeTax cannot be applied to given types; required double; found: no arguments; reason: actual and formal argument lists differ in length" I've gone over my code multiple times and I cannot find where the error is located. It is near the end of the code on the line "userTax = test.getUserTax(); import java.util.Scanner; //Needed for the Scanner Class /** * Write a description of class IncomeTax here. * * @author CD * 11/30/2012 * The IncomeTax class determines how much tax you owe based on taxable income. */

How to enter a LocalDate value into BlueJ “Create Object” dialog box

末鹿安然 提交于 2019-12-02 10:59:32
问题 I'm not trying to format the date in YYYY-MM-DD or dd/MM/YYYY. I'm asking about the literal format of LocalDate. I just started learning Java and I am using this IDE called BlueJ. and I want to create a test method. The screenshot will show what I am trying to do Now since from the constructor we know that it requires a int, LocalDate and a double. I've searched online and found that https://www.javabrahman.com/java-8/java-8-working-with-localdate-localtime-localdatetime-tutorial-with

Java variable might not have been initialized? [closed]

爷,独闯天下 提交于 2019-12-02 08:41:37
My BlueJ IDE is showing this error when I try to compile the class. I can't see what I'm doing wrong. Before you can use a variable inside your if block , you need to initialize it. Try this : double albedo=0; Instead of : double albedo; Keep in mind though that your variable will remain 0 if your condition returns false as you haven't specified an else block. If the condition in the if clause is not true, the variable is not assigned. In this case, the return that follows references an uninitialized variable. This is a private method and local variables don't get default values, they have to