Results 1 to 2 of 2
- 03-29-2010, 01:02 AM #1
Member
- Join Date
- Mar 2010
- Posts
- 2
- Rep Power
- 0
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);
}
}
}
- 03-29-2010, 01:07 AM #2
Member
- Join Date
- Mar 2010
- Posts
- 2
- Rep Power
- 0
Similar Threads
-
Ready To Program, Images in HSA Console?
By habbah in forum New To JavaReplies: 2Last Post: 01-17-2010, 03:50 AM -
[SOLVED] Ready to Program Java IDE
By Starr29 in forum New To JavaReplies: 9Last Post: 07-24-2009, 05:21 PM -
[SOLVED] Ready to Program Java IDE Problem #3 PacMan For Loop to Slide Across the Scr
By Starr29 in forum New To JavaReplies: 3Last Post: 07-18-2009, 01:26 PM -
Ready to Program Java IDE Problem #4
By Starr29 in forum New To JavaReplies: 5Last Post: 01-06-2009, 03:38 PM -
[SOLVED] Ready to Program Java IDE Problem #2
By Starr29 in forum New To JavaReplies: 2Last Post: 01-03-2009, 01:02 AM
Bookmarks