Question: Create a JavaFX application that lets the user enter the food charge for a meal at a restaurant. When a button is clicked, the application
Create a JavaFX application that lets the user enter the food charge for a meal at a restaurant. When a button is clicked, the application should calculate and display the amount of an 18 percent tip, 7 percent sales tax, and the total of all three amounts. Include all the java files and fxml files.
This is what I have, but I need the FXML file:
package WordNode;
import java.awt.Button;
import java.util.Scanner;
public class TipTaxTotal { public static void main(String [] args)
{ double charge; double tax = 0.07; double tipRate = 0.18; double totalWithTax;
double taxAmount;
double tipAmount;
double grandTotal;
Scanner keyboard = new Scanner(System.in); //ask for charge from the user
System.out.println("What is the total of your bill? ");
charge = keyboard.nextDouble(); //calculate the charge and the tip
taxAmount = charge * tax;
totalWithTax = charge + taxAmount;
tipAmount = totalWithTax * tipRate;
grandTotal = totalWithTax + tipAmount; //Display it back to the user
System.out.println("Your meal: $" + charge);
System.out.println("Your tax: $" + taxAmount);
System.out.println("Your meal with tax: $" + totalWithTax);
System.out.println("The total cost with the tip included: $" + grandTotal); } }
Here's the sample output:

OUTPUT 49 meal: $49.0 tax: $3.43 meal + tax: $52.43 total cost (tip included) : 561.8674
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
