TRENDING NEWS

POPULAR NEWS

Could Someone Help Me Get Started With Writing A Code For This On Bluej

How do I run a java code created with BlueJ?

Right click on your main class (which you are going to execute one of its methods) and create an instance of it (using the menu item which apears).

Now on the bottom of the BlueJ you will see the created object.

Now right click on the object and a menu with a list of PUBLIC methods of the object apears. Now you should choose one of the methods of this object and BlueJ will run it.

You should put your desired startup code in that specific method.

Mac

Could someone please help with the following program in java? I keep getting errors every time I try to run it?

It's kind of hard for us to comment on any errors when you don't show us your code or tell us what the errors are. I really don't know what you expect us to do there. I'm also not sure how you can "have the general program ready" yet say " i don't know how to create the Tester class. Help with Thermometer class is also appreciated!" Do you have the program ready, or not? If you do, how can we help with it if you don't show it to us?

The tester class is just a main method that makes sure everything in the class works properly. So it might be something like this (depending on what you named your methods):

public class ThermoTester
{
public static void main(String[] args)
{
Thermometer t = new Thermometer(); // test the constructor
t.displayTemperature(); // display the temp so we know the constructor set it to 60; also tests the display method
t.changeTemperature(15); // test the change method
t.displayTemperature(); // display the temp so we know the change method worked
t.resetTemperature(); // test the reset method
t.displayTemperature(); // display the temp so we know the reset method worked
}
}

Help with BlueJ and decimals?

Im trying to run an arthimetic program using decimals, but BlueJ wont let me compile them. It says "possible loss of precision", and wont let me save or run the program. Here is the program(a work in progress), if anyone can help me figure out what Im doing, it would be greatly appreciated!!!


public class CalculationsV1
{
public static void main(String[ ] args)
{
int iNum1 = 4;
int iNum2 = 8;
int iNum3 = 23.51;
int iNum4 = 8.9325;

// Addition
System.out.println("Addition");
System.out.print(iNum1 + " plus " + iNum2 + " = ");
System.out.println(iNum1 + iNum2); //two integers
System.out.print(iNum3 + "plus" + iNum4 + "=");
System.out.println(iNum3 + iNum4); //two integers

// Subtraction

System.out.println("Subtraction");
System.out.println(9 - 33);
System.out.println(98.6 - 47.0038);
//System.out.println();

// Multiplication
System.out.println("Multiplication");
System.out.println(15 * 3 * 201);
System.out.println(3.14 * 5.0 * 5.0);
//System.out.println();

// Division
System.out.println("Division");
System.out.println(48 / 8);
System.out.println(212.0 / 32.0);
//System.out.println();

// Modulus operator
System.out.println("Modulus");
System.out.println(23 % 15);
System.out.println(3298.7 % 243.1);
//System.out.println();

} // end of main method
} // end of class

Can anyone help me with the Java code to find the minimum, maximum and mean value of a set of numbers?

I'm going to assume that you know how to read the numbers from the file into an array, and that they're integers. Once they're in an array we can find the min, max and mean of the numbers.

1. Min
int minVal = a[0];
for (int i = 0; i < a.length; i++) {
if (minVal > a[i]) {
minVal = a[i];
}
}

At the end of this loop, min will have the lowest value of a[]. Why? Well, the loop visits each element, and if the current element is less than the smallest found so far, the current value replaces it because it is now the smallest found so far.

2. Max
int maxVal = a[0];
for (int i = 0; i < a.length; i++) {
if (maxVal < a[i]) {
maxVal = a[i];
}
}

Max is similar but with a twist. Whenever we find a value in a[] that is larger than the largest found so far, we remember its value and continue. By the end we will have the maximum value in max.

3. Mean
double meanVal = 0;
for (int i = 0; i < a.length; i++) {
meanVal += a[i];
}
meanVal = meanVal / a.length;

The mean is the sum of the numbers divided by the number of elements. So we just accumulate all the numbers and then divide by the length of the array.

If you need more help with the I/O, check out the URL below and we can talk more.

Help me wid java bluej?

I very much doubt you are going to have anyone do your homework for you in here. You may get lucky but too many have tried before.

Here's a Java tutorial that will help if you are prepared to do some work for yourself.
http://java.sun.com/docs/books/tutorial/...

If you were to ask something like,
"Here's the code I have written. It's not working and I wondered if someone could point out my mistake.",
you may well get some help and assistance.

But just asking us to do all the work in exchange for 10 points probably won't work.

Best of luck.

///

Computer Program using Java and BlueJ. Can you please at least start me up with some codes??

Write an application that uses random-number generation to create sentences. Use four arrays of strings called article, noun, verb and preposition. Create a sentence by selecting a word at random from each array in the following order: article, noun, verb, preposition, article and noun. As each word is picked, concatenate it to the previous words in the sentence. The words should be separated by spaces. When the final sentence is output, it should start with a capital letter and end witha period. THe application should generate 20 sentences and output them to a text area.
The article array should contain the articles "the", "a", "one", "some", and "any"; the noun array should contain the nouns "boy", "girl", "dog", "town" and "car"; the verb array should contain the verbs "drove", "jumped", "ran", "walked" and "skipped"; the preposition array should contain the prepositions "to", "from", "over", "under" and "on".

Generate random numbers on bluej?

i know that you need to use Math.random() to generate numbers from 1 to whatever. But i was wondering if you can generate numbers from specified numbers like only generate numbers from 5 to 10 or from 10 to 20. Thanks in advance for the help! :P

How do I code this in Java? Bluej program?

The directions say to write a program that displays an 8 by 8 grid of panels, all of which are initially colored white. When the user presses the mouse button within a panel, its color should change to a randomly generated color.

To be specific, how do I start off making the 8x8 grid? I'm having trouble with figuring out what I need to type, but I know I need to have a GUI to execute it and a ColorPanel for the background. The clicking stuff I will figure out later, but for now, I am stuck on this.

TRENDING NEWS