|
||||||
| Java Help Java Help forum discussing all Java platforms - J2ME, J2SE and J2EE - as well as relevant standards, APIs and frameworks such as Swing, Servlets, JSPs, Applets, Struts, Spring, Hibernate, ANT, EJB, and other Java-related topics. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
I am so freaking lost. I am completely new to programming. I bought a java programming book to try and teach myself. This is one of the programs it asks you to make. It doesn't show you how to do it either. I have been able to do all the programs it has requested so far. I'm freakin stumped. It asks you to do this program without using the math operators. any help here would be greatly appreciated. Ill make it worth your time to respond. My e-mail is CastorTroy357@hotmail.com. thanks in advance to anyone that helps.
1)Prompt the user and accept a number from standard input. 2)Prompt the user and accept a symbol character from standard input. The symbol must be either an ^ or an !. If it is neither of these, display an error message and end the program. 3)If the symbol is a !, compute the factorial of the number entered in step 1 and display the result. 4) if the symbol is a ^, prompt the user to enter a second number, and then calculate the 1st number to the power of the 2nd number (similar to tonight's exercise). Display the result. 5) You must use iteration/loops for the factorial and exponent calculations |
| Sponsored Links |
|
|
|
|||||
|
Do you know how to compute factorials and integer powers?
__________________
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall |
|
|||||
|
break the problem up into smaller problems. (hopefully the book you bought is using java 1.5)
1) and 2), look up how to accept import from the keyboard(hint: Scanner!) 2) in what way would you check(keyword: check) if it's a certain character? think what kind of statement that would use 3) and 4) simply develop seperate cases based on the results of the check. like: Code:
if( this is true) then do this else if (that is true) then do that look in the java API for methods if your book doesn't lay them out. http://java.sun.com/j2se/1.5.0/docs/api/ that site can be your best friend sometimes. and you won't learn much if you ask for all the code and have someone email it. you HAVE to be able to do it on your own, or else completing the exercise is worthless. good luck! Last edited by icepack; 10-10-2006 at 08:37 PM. Reason: cause i'm magic |
|
|||||
|
im pretty new to java but for an input box i woud do something like this...
Code:
UserInput = new javax.swing.JOptionPane().showInputDialog("Enter a value");
Code:
x = Integer.parseInt( UserInput ); but i know very little regarding java so dont quote me |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Best program for SQL database manipulation | Rhadamanthys | Database & Database Programming | 3 | 07-02-2007 02:32 PM |
| How do I Program another Program? ! | bosco | General Programming | 1 | 06-15-2007 11:15 AM |
| Need help w/ word count program (ASAP) | siren | C and C++ | 1 | 04-23-2007 08:14 AM |
| How to modify a program written in .NET 2.0? | jackyjack | C# Programming | 7 | 03-27-2007 12:26 PM |
| Xav | ........ | 1024.41 |
| MeTh0Dz|Reb0rn | ........ | 974.08 |
| morefood2001 | ........ | 850.04 |
| John | ........ | 841.93 |
| WingedPanther | ........ | 661.52 |
| marwex89 | ........ | 575.59 |
| Brandon W | ........ | 456.18 |
| chili5 | ........ | 292.12 |
| orjan | ........ | 187.41 |
| Steve.L | ........ | 181.88 |
Goal: 100,000 Posts
Complete: 79%