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
Ahat [919]
3 years ago
11

In this assignment, you will write a user interface for your calculator using JavaFX. Your graphical user interface (GUI) should

look like the screenshot below (creativity is good, but you also need to be able to design to customer specifications). When the user closes the window, the program should end. For this assignment the GUI does not need to respond to any other user input. Note that we are developing this GUI completely separately from any class. This is a common design pattern that is often called ModelView-Controller, or MVC. The model is the data your program deals with, the view is the user interface, and the controller responds to input from the view by acting on the data in the model. Developing programs in this way allows you to create diffe

Engineering
1 answer:
Zolol [24]3 years ago
4 0

Answer:

Kindly note that, you're to replace "at" with shift 2 as the brainly text editor can't take the symbol

Explanation:

import javafx.application.Application;

import javafx.stage.Stage;

import javafx.scene.Group;

import javafx.scene.Scene;

import javafx.scene.layout.VBox;

import javafx.scene.layout.HBox;

import javafx.scene.control.TextField;

import javafx.scene.control.Button;

public class Calculator extends Application {

public static void main(String[] args) {

// TODO Auto-generated method stub

launch(args);

}

"at"Override

public void start(Stage primaryStage) throws Exception {

// TODO Auto-generated method stub

Group root = new Group();

VBox mainBox = new VBox();

HBox inpBox = new HBox();

TextField txtInput = new TextField ();

txtInput.setEditable(false);

txtInput.setStyle("-fx-font: 20 mono-spaced;");

txtInput.setText("0.0");

txtInput.setMinHeight(20);

txtInput.setMinWidth(200);

inpBox.getChildren().add(txtInput);

Scene scene = new Scene(root, 200, 294);

mainBox.getChildren().add(inpBox);

HBox rowOne = new HBox();

Button btn7 = new Button("7");

btn7.setMinWidth(50);

btn7.setMinHeight(50);

Button btn8 = new Button("8");

btn8.setMinWidth(50);

btn8.setMinHeight(50);

Button btn9 = new Button("9");

btn9.setMinWidth(50);

btn9.setMinHeight(50);

Button btnDiv = new Button("/");

btnDiv.setMinWidth(50);

btnDiv.setMinHeight(50);

rowOne.getChildren().addAll(btn7,btn8,btn9,btnDiv);

mainBox.getChildren().add(rowOne);

HBox rowTwo = new HBox();

Button btn4 = new Button("4");

btn4.setMinWidth(50);

btn4.setMinHeight(50);

Button btn5 = new Button("5");

btn5.setMinWidth(50);

btn5.setMinHeight(50);

Button btn6 = new Button("6");

btn6.setMinWidth(50);

btn6.setMinHeight(50);

Button btnMul = new Button("*");

btnMul.setMinWidth(50);

btnMul.setMinHeight(50);

rowTwo.getChildren().addAll(btn4,btn5,btn6,btnMul);

mainBox.getChildren().add(rowTwo);

HBox rowThree = new HBox();

Button btn1 = new Button("1");

btn1.setMinWidth(50);

btn1.setMinHeight(50);

Button btn2 = new Button("2");

btn2.setMinWidth(50);

btn2.setMinHeight(50);

Button btn3 = new Button("3");

btn3.setMinWidth(50);

btn3.setMinHeight(50);

Button btnSub = new Button("-");

btnSub.setMinWidth(50);

btnSub.setMinHeight(50);

rowThree.getChildren().addAll(btn1,btn2,btn3,btnSub);

mainBox.getChildren().add(rowThree);

HBox rowFour = new HBox();

Button btnC = new Button("C");

btnC.setMinWidth(50);

btnC.setMinHeight(50);

Button btn0 = new Button("0");

btn0.setMinWidth(50);

btn0.setMinHeight(50);

Button btnDot = new Button(".");

btnDot.setMinWidth(50);

btnDot.setMinHeight(50);

Button btnAdd = new Button("+");

btnAdd.setMinWidth(50);

btnAdd.setMinHeight(50);

rowFour.getChildren().addAll(btnC,btn0,btnDot,btnAdd);

mainBox.getChildren().add(rowFour);

HBox rowFive = new HBox();

Button btnEq = new Button("=");

btnEq.setMinWidth(200);

btnEq.setMinHeight(50);

rowFive.getChildren().add(btnEq);

mainBox.getChildren().add(rowFive);

root.getChildren().add(mainBox);

primaryStage.setScene(scene);

primaryStage.setTitle("GUI Calculator");

primaryStage.show();

}

}

You might be interested in
What are the four causes of electrical faults?
Arada [10]

Answer:

Electrical faults are also caused due to human errors such as selecting improper rating of equipment or devices, forgetting metallic or electrical conducting parts after servicing or maintenance, switching the circuit while it is under servicing, etc.

Explanation:

6 0
3 years ago
The human eye, as well as the light-sensitive chemicals on color photographic film, respond differently to light sources with di
jeka57 [31]

Answer:

a) at T = 5800 k  

  band emission = 0.2261

at T = 2900 k

  band emission = 0.0442

b) daylight (d) = 0.50 μm

    Incandescent ( i ) =  1 μm

Explanation:

To Calculate the band emission fractions we will apply the Wien's displacement Law

The ban emission fraction in spectral range λ1 to λ2 at a blackbody temperature T can be expressed as

F ( λ1 - λ2, T ) = F( 0 ----> λ2,T) - F( 0 ----> λ1,T )

<em>Values are gotten from the table named: blackbody radiati</em>on functions

<u>a) Calculate the band emission fractions for the visible region</u>

at T = 5800 k  

  band emission = 0.2261

at T = 2900 k

  band emission = 0.0442

attached below is a detailed solution to the problem

<u>b)calculate wavelength corresponding to the maximum spectral intensity</u>

For daylight ( d ) = 2898 μm *k / 5800 k  = 0.50 μm

For Incandescent ( i ) = 2898 μm *k / 2900 k = 1 μm

3 0
3 years ago
Ensure at least ___ distance around fire sprinkler heads, safety showers, eyewash units, and heating and cooling units to ensure
vampirchik [111]

90 inches

Explanation:

According to OSHA requirement, the distance around safety showers and eyewash should be between 82-96 inches off the flow. This will allow for maximum diameter of spray.

Learn More

Safety distance around safety showers:brainly.com/question/11123362

Keywords: distance, fire sprinkler head, safety showers, eyewash units,heating and cooling units

#LearnwithBrainly

5 0
3 years ago
A packet weighs 40kg in air but when it is totally submerged into a 1mx1m square tank the weight of the packet is only 18kg. How
Irina18 [472]

Answer:

water  rise = 22 mm

Explanation:

weight of packet IN AIR = 40 *9.81 =392.4 N

weight of packet  IN WATER= 18 *9.81 =176.58 N

by Archimedi's principle

difference in weight = weight of displaced water

w_a - w_w = \rho_w v_d g

392.4 - 176.58 = 1000* v_d* 9.81

v_d = 0.022 m^3

v_d = A*H_rise

0.022 =1*H_rise

H_rise = 0.022 m = 22 mm

water  rise = 22 mm

5 0
3 years ago
Think of the differences between circuit-switching and packet-switching paradigms in the Internet core design. Assume an Interne
dem82 [27]

Answer:

0.264 ; 0.079

Explanation:

Given that:

Sample size, n = 100

Probability of being active, p = 1% = 1/100 = 0.01

Using the binomial probability relation :

P(x =x) = nCx * p^x * (1 - p)^(n - x)

Probability that more than 1 user will be active

P(x > 1) = 1 - [p(x=0) + p(x = 1)]

P(x = 0) = 100C0 * 0.01^0 * 0.99^100 = 0.366

P(x = 1) = 100C1 * 0.01^1 * 0.99^99 = 0.370

P(x > 1) = 1 - [0.366 + 0.370]

P(x > 1) = 0.264

2.)

Probability that more than 2 user will be active

P(x > 2) = 1 - [p(x=0) + p(x = 1) + p(x = 2)]

P(x = 0) = 100C0 * 0.01^0 * 0.99^100 = 0.366

P(x = 1) = 100C1 * 0.01^1 * 0.99^99 = 0.370

P(x = 2) = 100C2 * 0.01^2 * 0.99^98 = 0.185

P(x > 1) = 1 - [0.366 + 0.370 + 0.185]

P(x > 1) = 0.079

7 0
3 years ago
Other questions:
  • Rain falls on a 1346 acre urban watershed at an intensity of 1.75 in/hr for a duration of 1 hour. The catchment land use is 20%
    10·1 answer
  • An air conditioner using refrigerant-134a as the working fluid and operating on the ideal vapor-compression refrigeration cycle
    7·2 answers
  • A mass weighing 22 lb stretches a spring 4.5 in. The mass is also attached to a damper with Y coefficient . Determine the value
    12·1 answer
  • What do you need for an object to fly?
    10·1 answer
  • Find values of the intrinsic carrier concentration n for silicon at –70° 0° 20° C, 100° C, and C. At 125° each temperature, what
    14·1 answer
  • Fill in the blank to correctly complete the statement below.
    6·1 answer
  • A motor driven water pump operates with an inlet pressure of 96 kPa (absolute) and mass flow rate of 120 kg/min. The motor consu
    7·1 answer
  • ________ are written to “maximize” or “minimize” a specific value associated with the product needs in order to define the goal
    9·2 answers
  • Based on your reading of the following, how does a triple save a fire department in time?
    5·1 answer
  • The product of two factors is 4,500. If one of the factors is 90, which is the other factor?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!