There are three seating categories at a stadium. For a softball game, Class A se
ID: 3543272 • Letter: T
Question
There are three seating categories at a stadium. For a softball game, Class A seats cost $15, Class B seats cost $12, and Class C seats cost $9. Design a module program that asks how many tickets for each class of seats were sold, and then displays the amount of income generated from ticket sales. For this assignment I am using Visual Studio 2010 for C#.
Now if someone wants to help me by writing the whole code then I would naturally welcome that, but below is what I have so far and I am now stuck. I am very new to programming in general and am taking this class online, which doesn't help my learning curve at all. Any help or input is welcome. Thanks.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
class Constants
{
public const double priceOfClassATickets = 15;
public const double priceOfClassBTickets = 12;
public const double priceOfClassCTickets = 9;
}
class Variables
{
int classATickets;
int classBTickets;
int classCTickets;
}
private void ticketsSoldLabel1_Click(object sender, EventArgs e)
{
}
private void ticketsLabel1_Click(object sender, EventArgs e)
{
}
private void ticketsBox1_TextChanged(object sender, EventArgs e)
{
}
private void ticketsLabel2_Click(object sender, EventArgs e)
{
}
private void TicketsBox2_TextChanged(object sender, EventArgs e)
{
}
private void ticketsLabel3_Click(object sender, EventArgs e)
{
}
private void TicketsBox3_TextChanged(object sender, EventArgs e)
{
}
private void revenueGenteratedLabel1_Click(object sender, EventArgs e)
{
}
private void revenueLabel1_Click(object sender, EventArgs e)
{
}
private void revenueATotal1_Click(object sender, EventArgs e)
{
}
private void revenueLabel2_Click(object sender, EventArgs e)
{
}
private void revenueBTotal1_Click(object sender, EventArgs e)
{
}
private void revenueLabel3_Click(object sender, EventArgs e)
{
}
private void revenueCTotal1_Click(object sender, EventArgs e)
{
}
private void totalLabel1_Click(object sender, EventArgs e)
{
}
private void totalRevenue1_Click(object sender, EventArgs e)
{
}
private void calculateRevenue1_Click(object sender, EventArgs e)
{
}
private void clearButton1_Click(object sender, EventArgs e)
{
ticketsBox1.Text = "";
ticketsBox2.Text = "";
ticketsBox3.Text = "";
}
private void exitButton1_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
Explanation / Answer
def main():
intro()
class_a()
class_b()
class_c()
total()
def intro():
print("Welcome to the ticket sales program"
print("Class A costs $15"
print("Class B costs $12"
print("Class C costs $9"
print("You will be asked to enter the number of tickets sold"
print("The program would calculate the income generated"
print()
def class_a():
ticket_a = int(input("Enter the number of tickets sold for Class A:")
global cost_a
cost_a = ticket_a * 15
print()
def class_b():
ticket_b = int(input("Enter the number of tickets sold for Class B:")
global cost_b
cost_b = ticket_b * 12
print()
def class_c():
ticket_c = int(input("Enter the number of tickets sold for Class C:")
global cost_c
cost_c = ticket_c * 9
print()
def total():
total = cost_a + cost_b + cost_c
print("The total income generated frocm the ticket sales is $", format(total, ',.2f'), sep = '')
main()