Java Reference
In-Depth Information
COMPLETE PROGRAM LISTING
//***************************************************************
// Author D.S. Malik
//
// Program: Movie ticket sale and donation to charity.
// This program prompts the user to input the movie name, adult
// ticket price, child ticket price, number of adult tickets
// sold, number of child tickets sold, and the percentage of the
// gross amount to be donated to the charity.
// The program outputs the movie name, the number of tickets
// sold, the gross amount, the percentage of the gross amount
// donated to the charity, the amount donated to the charity,
// and the net amount.
//***************************************************************
3
import javax.swing.JOptionPane;
public class MovieTicketSale
{
public static void main(String[] args)
{
//Step 1
String movieName;
String inputStr;
String outputStr;
double adultTicketPrice;
double childTicketPrice;
int noOfAdultTicketsSold;
int noOfChildTicketsSold;
double percentDonation;
double grossAmount;
double amountDonated;
double netSaleAmount;
movieName = JOptionPane.showInputDialog
("Enter the movie name");
//Step 2
inputStr = JOptionPane.showInputDialog
("Enter the price of an adult ticket"); //Step 3
adultTicketPrice = Double.parseDouble(inputStr);
//Step 4
inputStr = JOptionPane.showInputDialog
("Enter the price of a child ticket");
//Step 5
childTicketPrice = Double.parseDouble(inputStr);
//Step 6
Search WWH ::




Custom Search