Results 1 to 2 of 2
  1. #1
    cold is offline Member
    Join Date
    Mar 2010
    Posts
    2
    Rep Power
    0

    Question hi i need help with adding the total in this java ready to program IDE.

    //iam totally lost on how to calculate the total tickets in the end like i have to add the total money and total tickets ordered..i would appreciate if someone is willing to help me =(

    import javax.swing.JOptionPane;
    public class Tickz
    {
    public static void main (String[] args)
    {
    int tickets, options;
    double bluejays = 40.00;
    double stratford = 35.00;
    double gst = 0.05;
    double pst = 0.08;
    int variable = 0;
    String adress;
    String name;
    int phone;
    String method;
    int expire;
    String typecredit;

    while (variable < 3)
    {
    options = Integer.parseInt (JOptionPane.showInputDialog ("Please select an option: \n1) Blue Jays tickets ($40.00) \n2) Startford Festival tickets ($35.00) \n3) Exit "));

    if (options == 1)
    {
    tickets = Integer.parseInt (JOptionPane.showInputDialog ("Enter the amount of tickets you want"));
    System.out.println ("Bluejays Ticket(s) " + tickets);
    System.out.println ();
    System.out.println ("The subtotal is " + "$" + (bluejays * tickets));
    System.out.println ();
    System.out.println ("GST = " +(bluejays * tickets)* gst + "$");
    System.out.println ("PST = " +(bluejays * tickets)* pst + "$");
    System.out.println ();
    System.out.println ("The total cost of your order is: " + "$" + ((bluejays * tickets) + (bluejays * tickets) * (gst + pst)));
    System.out.println ();
    }

    if (options == 2)
    {
    tickets = Integer.parseInt (JOptionPane.showInputDialog ("Enter the amount of tickets you want"));
    System.out.println ("Stratford Ticket(s):" + tickets);
    System.out.println ();
    System.out.println ("The subtotal is " + "$" + (stratford * tickets));
    System.out.println ();
    System.out.println ("GST = " +(stratford * tickets)* gst + "$");
    System.out.println ("PST = " +(stratford * tickets)*pst + "$");
    System.out.println ();
    System.out.println ("The total cost of your order is: " + "$" + ((stratford * tickets) + (stratford * tickets) * (gst + pst)));
    }
    if (options == 3)
    variable = 3;
    //works fine till here i dont know how to do the rest =( help please
    }
    name = JOptionPane.showInputDialog ("please enter your name");
    adress = JOptionPane.showInputDialog ("please enter your adress");
    phone = Integer.parseInt (JOptionPane.showInputDialog ("Please enter your phone number"));
    System.out.println();
    System.out.println(""+ name +"");
    System.out.println(""+ adress +"");
    System.out.println(""+ phone +"");

    method = JOptionPane.showInputDialog ("select a method of payment:\n1)credit\n2)cash");

    if (method == 1)
    {


    typecredit = JOptionPane.showInputDialog ("please enter the type of credit you want to use ");
    expire = JOptionPane.showInputDialog ("please enter your cards expiry date");

    System.out.println();
    System.out.println("Mehtod of payment:" + typecredit);

    }
    }

    }

  2. #2
    cold is offline Member
    Join Date
    Mar 2010
    Posts
    2
    Rep Power
    0

    Default

    iam new to this forum and new to java so if i did anything wrong or against the rules please inform me.

Similar Threads

  1. Ready To Program, Images in HSA Console?
    By habbah in forum New To Java
    Replies: 2
    Last Post: 01-17-2010, 04:50 AM
  2. [SOLVED] Ready to Program Java IDE
    By Starr29 in forum New To Java
    Replies: 9
    Last Post: 07-24-2009, 06:21 PM
  3. Replies: 3
    Last Post: 07-18-2009, 02:26 PM
  4. Ready to Program Java IDE Problem #4
    By Starr29 in forum New To Java
    Replies: 5
    Last Post: 01-06-2009, 04:38 PM
  5. [SOLVED] Ready to Program Java IDE Problem #2
    By Starr29 in forum New To Java
    Replies: 2
    Last Post: 01-03-2009, 02:02 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •