This week's book giveaway is in the Java in General forum.
We're giving away four copies of Event Streams in Action and have Alexander Dean & Valentin Crettaz on-line!
See this thread for details.
Win a copy of Event Streams in Action this week in the Java in General forum!

macca Mason

Greenhorn
+ Follow
since Nov 26, 2003
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by macca Mason

Hello, I am having a problem with arrays. I want to put five varables in array [0]. Can this be done.



[ May 13, 2004: Message edited by: macca Mason ]
[ May 13, 2004: Message edited by: macca Mason ]
15 years ago
Hello. I am new to java.
I am having difficulty with if else statements.
I want it so that when the imputer types astra, Vauxhall should appear and if he types Fiesta, then Ford should appear.
This is done in case 2.


All thats being printed to screen when I choose option 2 and type astra is the word Nissan.
I belive I have got a simple error can you show me how to do itt properly. Thx
15 years ago
I have canceled the math.pow statement but used the for loop instead
Can you please show me some directions to go.
I belive the main problem is storing the power number so it can loop again
[ edited to improve code formatting for greater readability -ds ]
[ December 08, 2003: Message edited by: Dirk Schreckmann ]
15 years ago
I still have a problem with the code. I tryed to make the code simpler but there is one error which I can not resolve.
Can you please take look at my program.
15 years ago
Still got problem with my powers program can you please help!
Thanks

/*
C:\Documents and Settings\Mahmoud Maguid\My Documents\JavaCode\Coursework\Powers.java:20: '.class' expected
Math.pow(double,double)
^
C:\Documents and Settings\Mahmoud Maguid\My Documents\JavaCode\Coursework\Powers.java:22: ')' expected
System.out.println("The result of powers is "+ results);
^
C:\Documents and Settings\Mahmoud Maguid\My Documents\JavaCode\Coursework\Powers.java:20: unexpected type
required: value
found : class
Math.pow(double,double)
^
3 errors
Tool completed with exit code 1
*/
15 years ago
Hi Chi
How do I open the java.lang package?
15 years ago
Hi I am stuck. I need to make a program that allows me to raise a number to the power.
The initial number is entered by the user as so is the power value.


Hi am new to programming so be descriptive in your replies.
Please help me. I have been stuck for ages.
Thx
[ December 02, 2003: Message edited by: macca Mason ]
15 years ago
Thx Elouise
I will try my best to follow this.
15 years ago
Thx alot Ernest.
I will try and make these changes. But I new to programming so if I get stuck again trying to make these changes I will post here.
Thx
Macca
15 years ago
Hi I need a program which should calculate the factorial of given number. (the number is entered by the user)
(the factorial of 4 for example is 4*3*2*1 answer is 24)
My question is "how do I calculate the factorial of a given number?"

Can you please help me? I have stick on this for some time.
(btw I am new to programming)

class Conpronum
{
public static void main(String[ ]args)
{
//Declare variables
int num1

//Read in the user number
System.out.println ("\nPlease enter your a whole number:");
num1 = EasyIn.getInt();


This is all I have done so far. I don't know how to tackle this problem.
15 years ago
Thanks Chi and Stan for the help.
I will try to put this in my code. (but finding where about to put it will be difficult)
Thanks alot. If I have any more questions I'll post again.
15 years ago
Hi Dave.
Thx for replying.
Yeah my code runs fine, all I want it to do is ask the user at the end of the program if they wish to re-run the program or quit. By entering Y or N.
If the user enters anything apart from Y or N then I want the program to say "please enter Y or N". At the moment my program just quits when the user enters any character apart from Y. (when the user enters Y however the programs re-runs).
How can I make it so just Y and N are accepted characters in my while statement.

My full code is.
15 years ago
Hi I have a loop that if the user types in the char "y" then the program is repeated and if the user types in anything else then the program is ended.
I want to make it so that when the user types in only the char "n" the program ends and if the user types in anything apart from "y or n" then the program will ask the user to enter "y or N"
my code example:
//declare variables
char goOn = 'y';
while (goOn == 'Y'|goOn == 'y')
{
System.out.println ("Hello");

System.out.println("To re run the program enter Y. Or N to quit");
goOn = EasyIn.getChar();
}
//Write out end message
System.out.println("\n\nEnd of Program\n\n");
}

(ps.i am new to programming)
[ November 26, 2003: Message edited by: macca Mason ]
15 years ago