import java.util.*;
import java.io.*;
import javax.swing.JOptionPane;
public class Tvs
{
public static void main(String[] args)
{
String inputStr;
String outputStr;
int model;
inputStr = JOptionPane.showInputDialog
("This program asks the user to enter a television model number." +"\n"
+ "The description of the model chosen will be displayed" + "\n"
+ "\n"
+ "\n"
+ "Please enter the model chosen" + "\n"
+ "Model 100 comes with remote control, timer," + "\n"
+ "and stereo sound and costs $1000" + "\n"
+ "Model 200 come with all features of model 100" + "\n"
+ "and picture-in-picture, and costs $1200" + "\n"
+ "Model 300 comes with all features of model 200 and" + "\n"
+ "HDTV, flat screen, 16x9 aspect ratio and costs $2400" + "\n");
model = Integer.parseInt(inputStr);
switch (model)
{
case 100:
outputStr = "You chose model " + model + " TV with these features:" + "\n"
+ "Remote control, timer, and stereo sound" + "\n"
+ "Your price will be $1000.00" + "\n";
JOptionPane.showMessageDialog(null, outputStr,
"Television Selection",
JOptionPane.INFORMATION_MESSAGE);
break;
case 200:
outputStr = "You chose model " + model + " TV with these features:" + "\n"
+ "Remote control, timer, stereo sound and picture-in-picture" + "\n"
+ "Your price will be $1200.00" + "\n";
JOptionPane.showMessageDialog(null, outputStr,
"Television Selection",
JOptionPane.INFORMATION_MESSAGE);
break;
case 300:
outputStr = "You chose model " + model + " TV with these features:" + "\n"
+ "HDTV, flat screen, 16x9 aspect ratio" + "\n"
+ "picture-in-picture," + "\n"
+ "remote control, timer, and stereo sound" + "\n"
+ "Your price will be $2400.00" + "\n";
JOptionPane.showMessageDialog(null, outputStr,
"Television Selection",
JOptionPane.INFORMATION_MESSAGE);
break;
}
}
} |