Write an GUI application that display a menu system. The menu system should allo
ID: 3634965 • Letter: W
Question
Write an GUI application that display a menu system. The menu system should allow the user to select one package, one phone, and any of the options desired. As the user selects items from the menu, the application should show the prices of the items selected.(This GUI application uses AWT and SWING imports to display the menu system)
Question Details:
Cell Solutions, a cell phone provider, sells the following packages:
300 minutes per month: $45.00 per month
800 minutes per month: $65.00 per month
1500 minutes per month: $99.00 per month
The provider sells the following phones. ( A 6% sales tax applies to the sale of a phone.)
Model 100: $29.95
Model 110: $49.95
Model 200: $99.95
Customers may also select the following options:
Voice mail: $5.00 per month
Text messaging: $10.00 per month
Explanation / Answer
import java.util.*;
import javax.swing.JOptionPane;
import java.lang.*;
public class cellPhonePackage
{
public static void main(String [] args)
{
double cost;
int choose;
int sels=0;
int cellmodel=0;
int cust=1;
int minmum;
String sel;
String strInput;
String strInput1;
String strInput2;
String strInput3;
choose=0;
while(choose<1||choose>3)
{
strInput = JOptionPane.showInputDialog(null,"Choose Cell Package 1. 300 minutes per month: $45.00 per month 2. 800 minutes per month: $65.00 per month 3. 1500 minutes per month: $99.00 per month ");
choose=Integer.parseInt(strInput);
}
if(choose == 1)
{
cost=45;
minmum=300;
}
else if(choose == 2)
{
cost=65;
minmum=800;
}
else
{
cost=99;
minmum=1500;
}
JOptionPane.showMessageDialog(null,"You selected The Package "+minmum+" minutes plan. The cost is "+cost+ " per month");
choose=0;
while(choose < 1||choose > 3)
{
strInput1 = JOptionPane.showInputDialog(null,"Select a phone model 1. Model 100: $59.95 2. Model 200: $79.95 3. Model 300: $99.95 ");
choose=Integer.parseInt(strInput1);
}
if(choose == 1)
{
cost=59.95;
cellmodel=100;
}
else if(choose == 2)
{
cost=79.95;
cellmodel=200;
}
else
{
cost=99.95;
cellmodel=300;
}
JOptionPane.showMessageDialog(null,"You selected The Model is "+ cellmodel+" The cost is $"+ cost );
choose=0;
while(choose<1||choose>4 )
{
strInput2 = JOptionPane.showInputDialog(null,"You select one of the following option 1. Voice mail: $5.00 per month 2. Text messaging: $10.00 per month 3. E-mail: $20.00 per month 4. Three services : $27.95 per month ");
choose=Integer.parseInt(strInput2);
}
if(choose == 1)
{
cost=5;
sel="voice mail";
}
else if(choose == 2)
{
cost=10;
sel="Text-Messaging";
}
else if(choose == 3)
{
cost=20;
sel="E-Mail";
}
else
{
cost=27.95;
sel="Thress services";
}
JOptionPane.showMessageDialog(null,"You selected the " +sel+ " The cost is $"+(cost)+" per month");
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.