Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i need help coding this in java: Instrcuctions: Cell Solutions, a cell phone provider, sells the following data plans: 8 gigabytes per month: $ 4

i need help coding this in java:
Instrcuctions:
Cell Solutions, a cell phone provider, sells the following data plans:
8 gigabytes per month: $45.00 per month
16 gigabytes per month: $65.00 per month
20 gigabytes per month: $99.00 per month
The provider sells the following phones. (A 6 percent sales tax applies to the sale of a phone.)
Model 100: $299.95
Model 110: $399.95
Model 200: $499.95
Customers may also select the following options:
Phone Replacement Insurance: $5.00 per month
WiFi Hotspot Capability: $10.00 per month
Write an application that displays a menu system. The menu system should allow the user to select one data plan, 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 is in main.java:
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.layout.VBox;
import javafx.scene.layout.HBox;
import javafx.geometry.Pos;
import javafx.geometry.Insets;
import javafx.scene.control.Label;
import javafx.scene.control.Button;
import javafx.scene.control.RadioButton;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ListView;
import javafx.scene.control.SelectionMode;
import javafx.scene.control.ToggleGroup;
import javafx.collections.ObservableList;
/**
Smartphone Packages
*/
public class SmartphonePackages extends Application
{
public static void main(String[] args)
{
// Launch the application.
launch(args);
}
@Override
public void start(Stage primaryStage)
{
// Data plan radio buttons
RadioButton gig8RadioButton = new RadioButton("8 Gigabytes per month");
RadioButton gig16RadioButton = new RadioButton("16 Gigabytes per month");
RadioButton gig20RadioButton = new RadioButton("20 Gigabytes per month");
gig8RadioButton.setSelected(true);
ToggleGroup dataGroup = new ToggleGroup();
gig8RadioButton.setToggleGroup(dataGroup);
gig16RadioButton.setToggleGroup(dataGroup);
gig20RadioButton.setToggleGroup(dataGroup);
Label dataPrompt = new Label("Select a Data Plan");
Label dataDescriptor = new Label("Data Plan Cost:");
Label dataCostLabel = new Label("$45 per month");
HBox dataCostHBox = new HBox(10, dataDescriptor, dataCostLabel);
VBox dataVBox = new VBox(10, dataPrompt, gig8RadioButton, gig16RadioButton,
gig20RadioButton, dataCostHBox);
// Register event handlers for the data plan radio buttons
gig8RadioButton.setOnAction(event ->
{
dataCostLabel.setText("$45 per month");
});
gig16RadioButton.setOnAction(event ->
{
dataCostLabel.setText("$65 per month");
});
gig20RadioButton.setOnAction(event ->
{
dataCostLabel.setText("$99 per month");
});
// Phone radio buttons
// Register event handlers for the phone radio buttons
// Options
CheckBox insuranceCheckBox = new CheckBox("Phone Replacement Insurance");
CheckBox hotspotCheckBox = new CheckBox("WiFi Hotspot Capabilty");
Label optionsDescriptor = new Label("Options Cost:");
Label optionsCostLabel = new Label("$0");
HBox optionsCostHBox = new HBox(10, optionsDescriptor, optionsCostLabel);
VBox optionsVBox = new VBox(10, insuranceCheckBox, hotspotCheckBox, optionsCostHBox);
// Register event handlers for the check boxes
insuranceCheckBox.setOnAction(event ->
{
});
hotspotCheckBox.setOnAction(event ->
{
});
// Put everything into a VBox
VBox mainVBox = new VBox(10, dataVBox, phoneVBox, optionsVBox);
mainVBox.setAlignment(Pos.CENTER);
mainVBox.setPadding(new Insets(10));
// Add the main VBox to a scene.
Scene scene = new Scene(mainVBox);
// Set the scene to the stage aand display it.
primaryStage.setScene(scene);
primaryStage.show();
}
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Modeling And Design

Authors: Toby J. Teorey, Sam S. Lightstone, Tom Nadeau, H.V. Jagadish

5th Edition

0123820200, 978-0123820204

More Books

Students also viewed these Databases questions

Question

Choosing Your Topic Researching the Topic

Answered: 1 week ago

Question

The Power of Public Speaking Clarifying the

Answered: 1 week ago