Hey! guys, i need help figurering out how to make this program ran.
Jack has decided his student organization is going to sell Oktoberfest shirts at Oktoberfest. In order to compete with other clubs, he wants to offer a 10% discount to anyone who buys 5 or more shirts. Also, Jack is going to have several promotional ads before Oktoberfest to try and boost sales at his booth. If a customer mentions the ad, they receive $2.00 off their order. Jack wants the output of the program to display the quantity ordered plus the total due so everyone working at the booth can see how many shirts need to be given to the customer and also how much money to collect. Jack will be selling the shirts for $10.00 each.
Complete this program using JOptionPane and if-else statements
Not really good at the if-else statement so i would like someone to point out my mistakes.
Below is my code:
import javax.swing.JOptionPane;
public class Oktoberfest3
{
public static void main(String[] args)
{
double shirtCount, discount, answer, total;
shirtCount = 0;
discount = 0.1;
total = 0.0;
shirtCount= Double.parseDouble(JOptionPane.showInputDialog("Enter total shirt count"));
if(shirtCount >= 5)
{
discount= (shirtCount* 10) * 0.1;
total= (shirtCount * 10) - discount;
}
else if (shirtCount <= 4);
{
total= (shirtCount * 10);
}
int answer1 = y;
int answer2 = n;
int y = JOptionPane.showConfirmDialog("Did customer mention ad?",JOptionPane.YES_NO_OPTION);
if (y == JOptionPane.YES_OPTION)
{
discount= (shirtCount* 10) * 0.1;
total= ((shirtCount * 10) - discount) - 2;
}
else if (n == JOptionPane.NO_OPTION)
{
total= (shirtCount * 10);
}
}
}