Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

when i run my code, i can't get anything. what is problem? import javafx.application.Application; import javafx.geometry.Insets; import javafx.scene.Scene; import javafx.scene.layout.*; import javafx.scene.control.*; import javafx.stage.Stage; import

when i run my code, i can't get anything.

what is problem?

import javafx.application.Application; import javafx.geometry.Insets; import javafx.scene.Scene; import javafx.scene.layout.*; import javafx.scene.control.*; import javafx.stage.Stage; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javax.swing.*; public class RetailPriceCalculator extends Application implements EventHandler { TextField textWholesale; TextField textMarkup; Button btn; @Override public void start(Stage primaryStage) throws Exception { HBox root = new HBox(); root.setSpacing(10); root.setPadding(new Insets(15,20,10,10)); Label lbl1 = new Label("Enter the wholesale cost"); root.getChildren().add(lbl1); textWholesale = new TextField(""); textWholesale.setPrefWidth(110); root.getChildren().add(textWholesale); Label lbl2 = new Label("Enter the markup cost"); root.getChildren().add(lbl2); textMarkup = new TextField(""); textMarkup.setPrefWidth(110); root.getChildren().add(textMarkup); btn = new Button("calculate retail Price"); root.getChildren().add(btn); Scene scene = new Scene(root,550,250); primaryStage.setTitle("Retail Price calculator"); primaryStage.setScene(scene); primaryStage.show(); } public void handle(ActionEvent event) { double wholesalecost, markupPct, retail; wholesalecost = Double.parseDouble(textWholesale.getText()); markupPct = Double.parseDouble(textMarkup.getText()); retail = wholesalecost + (wholesalecost * markupPct / 100); Alert alert = new Alert(Alert.AlertType.INFORMATION); if(event.getSource() == btn) { alert.setTitle("Message Box"); alert.setHeaderText(""); alert.setContentText(String.format("The Retail Price is %$",+retail)); alert.showAndWait(); } } public static void main(String[] args) { launch(args); } } 

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

C++ Database Development

Authors: Al Stevens

1st Edition

1558283579, 978-1558283572

More Books

Students also viewed these Databases questions

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago