Salon membership fee Male = 600 Female = 500
If Foreigner +850
n for not foreign
f if foreign
my code is

public static void main(String[] args)
{
String gender, nat;

gender=JOptionPane.showInputDialog("Gender");
nat=JOptionPane.showInputDialog("Nationality");

if (gender=="m" & nat=="n"){
JOptionPane.showMessageDialog(null,"Gender:" +gender +"\nNationality"+nat+"Fee is 1450"

This code doesn't work so I don't really know other solutions.

Recommended Answers

All 2 Replies

public static void main(String[] args)
{
String gender, nat;

gender=JOptionPane.showInputDialog("Gender");
nat=JOptionPane.showInputDialog("Nationality");

if (gender.equals("m") & nat.equals("n")){
JOptionPane.showMessageDialog(null,"Gender: " +gender +"\n Nationality: "+nat+" Fee is 1450");

}

- i hope this will help
you should the difference between this two things

if (name == "Mickey Mouse")   // Legal, but ALMOST SURELY WRONG
if (name.equals("Mickey Mouse"))  // Compares values, not refererences.

see this tutorial :
1-http://leepoint.net/notes-java/data/expressions/22compareobjects.html

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.