Answer to Question #208767 in Java | JSP | JSF for naraa

Question #208767

using javafx


A dentist requests you to develop the Dental Payment application. This application is used to calculate the total bill. The clinic provides the services and their price as shown in the table below.

 

Services Prices (RM)

1.Cleaning 35.00

2.Cavity Filling 150.00

3.X-ray 85.00

4.Flouride 50.00

5.Root canal 225.00

6.Other Type in

Your dental payment entry form is shown as follows:


-----------------------------------------

Dental Payment Application

-----------------------------------------

Dental Payment Entry Form

Patient Name

Services Prices(RM)

Cleaning 35.00

Cavity Filling 150.00

X-ray 85.00

Flouride 50.00

Root canal 225.00

Other

---------------------------------------

total

calculate




1
Expert's answer
2021-06-20T08:11:41-0400
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */


import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TextArea;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import java.util.Scanner;
/**
 *
 * @author Student
 */
public class start extends Application {
    
    @Override
    public void start(Stage primaryStage) {
        Scanner input = new Scanner(System.in);
        String name;
        System.out.print("Enter the patient name\n");
        name = input.next();
        double cleaning;
        System.out.print("Enter the cleaning price\n");
        cleaning = input.nextDouble();
        double filing;
        System.out.print("Enter the Cavity Filling\n");
        filing = input.nextDouble();
        double xray;
        System.out.print("Enter the X-ray\n");
        xray = input.nextDouble();
        double flouride;
        System.out.print("Enter the Flouride \n");
        flouride = input.nextDouble();
        double canal;
        System.out.print("Enter the Root Canal\n");
        canal = input.nextDouble();
        
        double other;
        System.out.print("Other Type\n");
        other = input.nextDouble();
        Button btn = new Button();
        double total = cleaning + xray + canal + flouride + filing;
        btn.setText("Say 'Hello World'");
        TextArea area = new TextArea();
        area.setText("----------------------------------\n"
                + "Dental Payment Application\n--------------------------------"
                + "\nDental Payment Entry Form\n Patient Name\t"+ name+"\nServices Prices(RM)"
                        + "1. Cleaning\t"+cleaning+"\n2. Cavity Filling\t" +filing+"\n3. X-ray\t"+xray+
                "\n4. Flouride\t"+flouride+"\n5. Root canal\t"+canal+"\n6. Other\t"+other+
                "\nTotal\t"+total);
        System.out.println("----------------------------------\n"
                + "Dental Payment Application\n--------------------------------"
                + "\nDental Payment Entry Form\n Patient Name\t"+ name+"\nServices Prices(RM)"
                        + "1. Cleaning\t"+cleaning+"\n2. Cavity Filling\t" +filing+"\n3. X-ray\t"+xray+
                "\n4. Flouride\t"+flouride+"\n5. Root canal\t"+canal+"\n6. Other\t"+other+
                "\nTotal\t"+total);
        btn.setOnAction(new EventHandler<ActionEvent>() {
            
            @Override
            public void handle(ActionEvent event) {
                System.out.println("Hello World!");
            }
        });
        
        StackPane root = new StackPane();
        root.getChildren().add(btn);
         root.getChildren().add(area);
        
        Scene scene = new Scene(root, 300, 250);
        
        primaryStage.setTitle("Hello World!");
        primaryStage.setScene(scene);
        primaryStage.show();
    }


    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        launch(args);
    }
    
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS