1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
aleksandr82 [10.1K]
3 years ago
12

Create a JavaFX application that lets the user enter the food charge for a meal at a restaurant. When a button is clicked, the a

pplication should calculate and display the amount of an 18 percent tip on the total food charge, 7 percent sales tax, and the total of all three amounts. For example, if $20 is entered as a food charge for a meal then $3.6 should be displayed for the tip, $1.4 should be displayed for sales tax, and $25 should be displayed as a total of all three amounts.
Engineering
1 answer:
marusya05 [52]3 years ago
8 0

Answer:

See explaination

Explanation:

package sample;

import javafx.application.Application;

import javafx.fxml.FXMLLoader;

import javafx.geometry.*;

import javafx.scene.Parent;

import javafx.scene.Scene;

import javafx.scene.control.Label;

import javafx.geometry.Insets;

import javafx.geometry.Pos;

import javafx.scene.Scene;

import javafx.scene.control.Button;

import javafx.scene.control.Label;

import javafx.scene.control.TextField;

import javafx.scene.layout.GridPane;

import javafx.stage.Stage;

public class Main extends Application {

atOverride // Replace the at with at symbol

public void start(Stage primaryStage) throws Exception{

primaryStage.setTitle("Calculator");

GridPane rootNode = new GridPane();

rootNode.setPadding(new Insets(15));

rootNode.setHgap(5);

rootNode.setVgap(5);

rootNode.setAlignment(Pos.CENTER);

Scene myScene = new Scene(rootNode, 300, 200);

rootNode.add(new Label("Amount:"), 0, 0);

TextField firstValue = new TextField();

rootNode.add(firstValue, 1, 0);

rootNode.add(new Label("Toatal is:"), 0, 5);

Button aButton = new Button("Calculate");

rootNode.add(aButton, 1, 2);

GridPane.setHalignment(aButton, HPos.LEFT);

TextField result = new TextField();

result.setEditable(false);

rootNode.add(result, 1, 5);

TextField tax = new TextField();

rootNode.add(new Label("Tax:"), 0, 3);

tax.setEditable(false);

rootNode.add(tax,1,3);

TextField tip = new TextField();

rootNode.add(new Label("Tip:"), 0, 4);

tip.setEditable(false);

rootNode.add(tip,1,4);

aButton.setOnAction(e -> {

Float value1 = Float.valueOf(firstValue.getText());

Float value2 =(value1*18)/100;

Float value3 = (value1*7)/100;

Float r = value1+value2+value3 ;

tax.setText(value3.toString());

tip.setText(value2.toString());

result.setText(r.toString());

});

primaryStage.setScene(myScene);

primaryStage.show();

}

public static void main(String[] args) {

launch(args);

}

}

You might be interested in
6. Question
valkas [14]

Answer:

Check  the 2nd, 3rd and 4th statements.

Explanation:

4 0
3 years ago
Which battery produces more volts per cell, maintenance type or maintenance free ?
Sonja [21]
Double aa battery. It’s is a very high bolted battery that can power up a lot of things
7 0
3 years ago
Elizabeth has been asked to design a pool umbrella that can withstand wind speeds of up to 30 miles per hour. Now that she under
zlopas [31]

Answer:

The correct option is;

D. She will need to research the problem even more

Explanation:

In other to properly design the pool umbrella that will be reliable and meet the needs of the particular customer, she will need to carry out a basic research about the environment where the pool umbrella is to be used, the presence of other factors that can impact on an idea for the pool umbrella.

She can then proceed to create a concept about the proposed pool umbrella, which is in the form of a paper concept

She will then proceed to carry out a more detailed study based on the paper concept that will consist of concept technology and application as well as functionality.

7 0
4 years ago
Read 2 more answers
Some soil has a discharge rate of 0.1 L/s, an area of 11 m2, and a hydraulic head that is given empirically by the function H =
Artist 52 [7]

Answer:

3.03 * 10 ⁻⁴ m/s

Explanation:

see attached picture for explanation.

3 0
4 years ago
A murder in a downtown office building has been widely publicized. You’re a police detective and receive a phone call from a dig
BaLLatris [955]

Answer:

Considering the plain view doctrine, which is an exception to the warrant requirement of the Fourth Amendment, is applied by law enforcement officers and courts who can seize evidence of a crime without a warrant, if the officer observes the evidence in plain view.

Explanation:

For any digital information related to a murder case that has been seized under the plain view doctrine to be used to convict you of a crime, has to comply with three conditions:

1.  The digital evidence must be in out in the open, and easily observable by the officer, this is what "plain view" refers to.

2. The officer must have a legal right to be where he got the information related to the case.

3. The 'incriminating' character of the information must be a clear hint of the murder to fall under the plain view doctrine and the officer´s experience will help him determining whether the information is evidence or not, upon probable cause related to a crime.

7 0
3 years ago
Read 2 more answers
Other questions:
  • If you're carrying a load that extends beyond the sides of your vehicle, you don't need to clearly mark it unless it extends mor
    13·2 answers
  • What are the main factors for the high material removal rate in broaching operations?
    9·1 answer
  • A closed, rigid tank is filled with a gas modeled as an ideal gas, initially at 27°C and a gage pressure of 300 kPa. If the gas
    8·1 answer
  • Scenario* The organization is a regional XYZ Credit Union/Bank that has multiple branches and locations throughout the region.*
    9·1 answer
  • At the beginning of the compression process of an air-standard Diesel cycle, p1 = 95 kPa and T1 = 300 K. The maximum temperature
    6·1 answer
  • Car crashes in the United States result in high costs. In<br> what areas do these high costs occur?
    8·1 answer
  • Were you surprised by the “pie data”? Is it true for you, your family, and your friends? Why or why not?
    13·2 answers
  • In the last 5 meters of braking, you lose ___ of your speed.
    6·1 answer
  • On-site oil storage containers must be marked “Used Oil.”<br> True<br> False
    12·1 answer
  • The moisture content in air (humidity) is measured by weight and expressed in pounds or ____________________.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!