I have a crisis
- From: "JavaClueless" <u16672@uwe>
- Date: Wed, 14 Dec 2005 17:18:30 GMT
I am a freshman in college and I totally gotleftbehind in this Intro to Java
class I'm taking. I have to hand in 7 assignments by the end of today. These
are the first two assignments:
"The assignment requires you to write two separate programs and thus
consistes of two parts. The first part is to write a program that reads two
numbers, let's say num1 and num2, each time using JOptionPane.showInputDialog,
Then use, for instance,
int value = Integer.parseInt(num1)
to convert each number to an int. Then add them and print the results.
The second part is to write a program that reads a 4-digit int, for instance,
3612, call it number. The program should separate the first two digits from
the last two, and then add them. Thus in our example the program would assign
36 to a variable, let's say firstOne, and then assign 12 to a second variable,
let's say secondOne. Finally, it would add the sum of firstOne and secondOne
(here, 36 + 12, or 48) and assign it to a third variable, let's say sum.
The output of your program should show the 4-digit integer read, the integer
formed from the first two digits, the integer formed from the last two and
then their sum. Hint: Use the %(mod) and /(intger division).
Use JOptionPane.showInputDialog to read your data and assign the input to the
string number. Then use
int value = Integer.parseInt(number)
to convert number to an int.
I have to do this to pass. Can anyone help me.
Thank You!
.
- Follow-Ups:
- Re: I have a crisis
- From: HalcyonWild
- Re: I have a crisis
- From: Roedy Green
- Re: I have a crisis
- From: Oliver Wong
- Re: I have a crisis
- From: IchBin
- Re: I have a crisis
- From: Rhino
- Re: I have a crisis
- From: Monique Y. Mudama
- Re: I have a crisis
- From: Gordon Beaton
- Re: I have a crisis
- Prev by Date: Re: Technical Overview of xProcess
- Next by Date: Storing into Arrays reading from .txt file (Streamtokenizer) help...
- Previous by thread: loading and starting webapp
- Next by thread: Re: I have a crisis
- Index(es):
Relevant Pages
|