Hi, I made a very basic program that asks for 3 products and their price; stores them in an array; then displays them.
This is the code:
import javax.swing.JOptionPane;
class fourchan{
public static void main(String args[]){
String [] product = new String [3];
double [] price = new double [3];
int count = 0;
for(count=0;count<3;count++){
product[count]=(JOptionPane.showInputDialog("Please enter the name of product " +(count+1) +":"));
price[count]=(Double.parseDouble(JOptionPane.showInputDialog("Please enter a price for product " +(count+1) +":")));
}
The problem I'm experiencing is that I do not how to to print the output on the same pop-up window as the template ( JOptionPane.showMessageDialog(null, "Number \t Product \t Price"); ).
Can anyone show me how to this?
Thanks,
Kim
P.s. This is my first time using 4chan and my Java skills are amateur at best so please be patient with me ^^
Name:
Anonymous2013-11-28 22:16
PROTIP: Never actually put your name or email address in the name or email address fields.
So what you're trying to do is show all the outputs in the same message?
Here you go :) Please come back again soon, we love newfriends.
import javax.swing.JOptionPane;
class fourchan{
public static void main(String args[]){
String [] product = new String [3];
double [] price = new double [3];
int count = 0;
for(count=0;count<3;count++){
product[count]=(JOptionPane.showInputDialog("Please enter the name of product " +(count+1) +":"));
price[count]=(Double.parseDouble(JOptionPane.showInputDialog("Please enter a price for product " +(count+1) +":")));
}
░░░░░░░▄▀▀▀▀▀▀▀▀▀▀▄▄░░░░░░░░░
░░░░▄▀▀░░░░░░░░░░░░░▀▄░░░░░░░
░░▄▀░░░░░░░░░░░░░░░░░░▀▄░░░░░ YOU HAVE BEEN VISITED BY
░░█░░░░░░░░░░░░░░░░░░░░░▀▄░░░ LE 'FEEL OF NO GF
░▐▌░░░░░░░░▄▄▄▄▄▄▄░░░░░░░▐▌░░
░█░░░░░░░░░░░▄▄▄▄░░▀▀▀▀▀░░█░░ A qt 3.14 gf will come to you,
▐▌░░░░░░░▀▀▀▀░░░░░▀▀▀▀▀░░░▐▌░ but ONLY if you post a
█░░░░░░░░░▄▄▀▀▀▀▀░░░░▀▀▀▀▄░█░ `>tfw no GF on this thread
█░░░░░░░░░░░░░░░░▀░░░▐░░░░░▐▌
▐▌░░░░░░░░░▐██▀█▄░░░░░░█▀█░▐▌
░█░░░░░░░░░░░▀▀▀░░░░░░▀▀▀▀░▀▄
░▐▌░░░░▄░░░░░░░░░░░░░▌░░░░░░█
░░▐▌░░▐░░░░░░░░░░░░░░▀▄░░░░░█
░░░█░░░▌░░░░░░░░▐▀░░░░▄▀░░░▐▌
░░░▐▌░░▀▄░░░░░░░░▀░▀░▀▀░░░▄▀░
░░░▐▌░░▐▀▄░░░░░░░░░░░░░░░░█░░
░░░▐▌░░░▌░▀▄░░░░▀▀▀▀▀▀░░░█░░░
░░░█░░░▀░░░░▀▄░░░░░░░░░░▄▀░░░
░░▐▌░░░░░░░░░░▀▄░░░░░░▄▀░░░░░
░▄▀░░░▄▀░░░░░░░░▀▀▀▀█▀░░░░░░░
.'"". I LIKE PYTHON BECAUSE I ENJOY HOMOSEXUAL
c' )"/ S/M. OH GUIDO MAKE ME USE THAT FUCKING
__> /_ INDENTATION. OH BABY I'M CUMMING.
.-`_ ._'-.
( -' \ :/ )/ THERE IS ONLY ONE WAY TO DO IT: GUIDO'S
\\._| ( // WAY! THAT MEANS YOU CAN'T USE ALL
'-/) \(, CONTROL STRUCTURES. IF YOU NEED A DO-
/ ) ) WHILE LOOP, A SWITCH OR BREAK OUT OF A
/ .'\ | NESTED LOOP, TOO BAD. GUIDO SAYS IT'S TO
/.' \| KEEP THE LANGUAGE CLEAN, BUT IT'S ACTUALLY
|| || TO PUNISN HIS SLAVES. THIS DOESN'T MEAN
__|/ |/__ THAT PYTHON IS FLAWED, JUST WORK AROUND IT.
_._) (,__; FUCK I'M CUMMING AGAIN.
>le pedophile sage
>le pedophile sage
>le pedophile sage
>le pedophile sage
>le pedophile sage
>le pedophile sage
>le pedophile sage
>le pedophile sage
>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage '
.'"". I LIKE PYTHON BECAUSE I ENJOY HOMOSEXUAL
c' )"/ S/M. OH GUIDO MAKE ME USE THAT FUCKING
__> /_ INDENTATION. OH BABY I'M CUMMING.
.-`_ ._'-.
( -' \ :/ )/ THERE IS ONLY ONE WAY TO DO IT: GUIDO'S
\\._| ( // WAY! THAT MEANS YOU CAN'T USE ALL
'-/) \(, CONTROL STRUCTURES. IF YOU NEED A DO-
/ ) ) WHILE LOOP, A SWITCH OR BREAK OUT OF A
/ .'\ | NESTED LOOP, TOO BAD. GUIDO SAYS IT'S TO
/.' \| KEEP THE LANGUAGE CLEAN, BUT IT'S ACTUALLY
|| || TO PUNISN HIS SLAVES. THIS DOESN'T MEAN
__|/ |/__ THAT PYTHON IS FLAWED, JUST WORK AROUND IT.
_._) (,__; FUCK I'M CUMMING AGAIN.
>le pedophile sage
>le pedophile sage
>le pedophile sage
>le pedophile sage
>le pedophile sage
>le pedophile sage
>le pedophile sage
>le pedophile sage
>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage '
.'"". I LIKE PYTHON BECAUSE I ENJOY HOMOSEXUAL
c' )"/ S/M. OH GUIDO MAKE ME USE THAT FUCKING
__> /_ INDENTATION. OH BABY I'M CUMMING.
.-`_ ._'-.
( -' \ :/ )/ THERE IS ONLY ONE WAY TO DO IT: GUIDO'S
\\._| ( // WAY! THAT MEANS YOU CAN'T USE ALL
'-/) \(, CONTROL STRUCTURES. IF YOU NEED A DO-
/ ) ) WHILE LOOP, A SWITCH OR BREAK OUT OF A
/ .'\ | NESTED LOOP, TOO BAD. GUIDO SAYS IT'S TO
/.' \| KEEP THE LANGUAGE CLEAN, BUT IT'S ACTUALLY
|| || TO PUNISN HIS SLAVES. THIS DOESN'T MEAN
__|/ |/__ THAT PYTHON IS FLAWED, JUST WORK AROUND IT.
_._) (,__; FUCK I'M CUMMING AGAIN.
>le pedophile sage
>le pedophile sage
>le pedophile sage
>le pedophile sage
>le pedophile sage
>le pedophile sage
>le pedophile sage
>le pedophile sage
>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage '
.'"". I LIKE PYTHON BECAUSE I ENJOY HOMOSEXUAL
c' )"/ S/M. OH GUIDO MAKE ME USE THAT FUCKING
__> /_ INDENTATION. OH BABY I'M CUMMING.
.-`_ ._'-.
( -' \ :/ )/ THERE IS ONLY ONE WAY TO DO IT: GUIDO'S
\\._| ( // WAY! THAT MEANS YOU CAN'T USE ALL
'-/) \(, CONTROL STRUCTURES. IF YOU NEED A DO-
/ ) ) WHILE LOOP, A SWITCH OR BREAK OUT OF A
/ .'\ | NESTED LOOP, TOO BAD. GUIDO SAYS IT'S TO
/.' \| KEEP THE LANGUAGE CLEAN, BUT IT'S ACTUALLY
|| || TO PUNISN HIS SLAVES. THIS DOESN'T MEAN
__|/ |/__ THAT PYTHON IS FLAWED, JUST WORK AROUND IT.
_._) (,__; FUCK I'M CUMMING AGAIN.
>le pedophile sage
>le pedophile sage
>le pedophile sage
>le pedophile sage
>le pedophile sage
>le pedophile sage
>le pedophile sage
>le pedophile sage
>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage '
.'"". I LIKE PYTHON BECAUSE I ENJOY HOMOSEXUAL
c' )"/ S/M. OH GUIDO MAKE ME USE THAT FUCKING
__> /_ INDENTATION. OH BABY I'M CUMMING.
.-`_ ._'-.
( -' \ :/ )/ THERE IS ONLY ONE WAY TO DO IT: GUIDO'S
\\._| ( // WAY! THAT MEANS YOU CAN'T USE ALL
'-/) \(, CONTROL STRUCTURES. IF YOU NEED A DO-
/ ) ) WHILE LOOP, A SWITCH OR BREAK OUT OF A
/ .'\ | NESTED LOOP, TOO BAD. GUIDO SAYS IT'S TO
/.' \| KEEP THE LANGUAGE CLEAN, BUT IT'S ACTUALLY
|| || TO PUNISN HIS SLAVES. THIS DOESN'T MEAN
__|/ |/__ THAT PYTHON IS FLAWED, JUST WORK AROUND IT.
_._) (,__; FUCK I'M CUMMING AGAIN.
>le pedophile sage
>le pedophile sage
>le pedophile sage
>le pedophile sage
>le pedophile sage
>le pedophile sage
>le pedophile sage
>le pedophile sage
>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage>le pedophile sage '