The Artima Developer Community
Sponsored Link

Java Answers Forum
java help

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Mo Evans

Posts: 1
Nickname: megamo
Registered: Jan, 2012

java help Posted: Jan 28, 2012 8:45 PM
Reply to this message Reply
Advertisement
Hey guys I'm new to programming (java) and I need to write a java code where a Cruise agency is offering college students to go on cruise for a week. The cruise has two different packages, standard and luxury. The standard package costs $1500 which leaves from Baltimore and the luxury package leaves from Vermont and it costs $2500 if you want to drive there or $3000 if you want to fly. Using GUI, it needs to ask for student name, ask the student if he/she would like the luxury package and if yes then it asks the student if he/she wants to drive or fly and display package selection and total amount at the end.
This is what I have so far and its not working, any help would be greatly appreciated.

import javax.swing.JOptionPane;
public class Cruise {
public static void main(String[] args)
{

int standard = 1;
int luxury = 2;
String name;
String input;
String output = "";
int userChoice = 0;
boolean x = false;

do{

name = JOptionPane.showInputDialog(null, "Enter your name");
output = output + name + "\n";


}while (JOptionPane.showConfirmDialog(null, " Is" + name + "taking a luxury vacation:")==JOptionPane.YES_OPTION);
output = output + name + "\n";
if( userChoice == 2)
{
JOptionPane.showConfirmDialog (null, "Is" + name + "flying today")=JOptionPane.YES_OPTION);
}
///else if (userChoice == 2)
{
JOptionPane.showMessageDialog(null, "you selected the luxury package");
}

}

}

Topic: Need help java looping Previous Topic   Next Topic Topic: File transfer via sockets

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use