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
A plane wall of thickness 0.1 m and thermal conductivity 25 W/m·K having uniform volumetric heat generation of 0.3 MW/m3 is insu
Contact [7]

Answer:

T = 167 ° C

Explanation:

To solve the question we have the following known variables

Type of surface = plane wall ,

Thermal conductivity k = 25.0 W/m·K,  

Thickness L = 0.1 m,

Heat generation rate q' = 0.300 MW/m³,

Heat transfer coefficient hc = 400 W/m² ·K,

Ambient temperature T∞ = 32.0 °C

We are to determine the maximum temperature in the wall

Assumptions for the calculation are as follows

  • Negligible heat loss through the insulation
  • Steady state system
  • One dimensional conduction across the wall

Therefore by the one dimensional conduction equation we have

k\frac{d^{2}T }{dx^{2} } +q'_{G} = \rho c\frac{dT}{dt}

During steady state

\frac{dT}{dt} = 0 which gives k\frac{d^{2}T }{dx^{2} } +q'_{G} = 0

From which we have \frac{d^{2}T }{dx^{2} }  = -\frac{q'_{G}}{k}

Considering the boundary condition at x =0 where there is no heat loss

 \frac{dT}{dt} = 0 also at the other end of the plane wall we have

-k\frac{dT }{dx } = hc (T - T∞) at point x = L

Integrating the equation we have

\frac{dT }{dx }  = \frac{q'_{G}}{k} x+ C_{1} from which C₁ is evaluated from the first boundary condition thus

0 = \frac{q'_{G}}{k} (0)+ C_{1}  from which C₁ = 0

From the second integration we have

T  = -\frac{q'_{G}}{2k} x^{2} + C_{2}

From which we can solve for C₂ by substituting the T and the first derivative into the second boundary condition s follows

-k\frac{q'_{G}L}{k} = h_{c}( -\frac{q'_{G}L^{2} }{k}  + C_{2}-T∞) → C₂ = q'_{G}L(\frac{1}{h_{c} }+ \frac{L}{2k} } )+T∞

T(x) = \frac{q'_{G}}{2k} x^{2} + q'_{G}L(\frac{1}{h_{c} }+ \frac{L}{2k} } )+T∞ and T(x) = T∞ + \frac{q'_{G}}{2k} (L^{2}+(\frac{2kL}{h_{c} }} )-x^{2} )

∴ Tmax → when x = 0 = T∞ + \frac{q'_{G}}{2k} (L^{2}+(\frac{2kL}{h_{c} }} ))

Substituting the values we get

T = 167 ° C

4 0
3 years ago
Why is it better for a CPU to have more than one cache?
Tomtit [17]

Answer:

In general a cache memory is useful because the speed of the processor is higher than the speed of the ram . so reducing the number of memory is desirable to increase performance .

Explanation:

.

.

#hope it helps you ..

(◕ᴗ◕)

3 0
2 years ago
Systematic searching is a skill that takes ________ to master.
bagirrra123 [75]

Answer: B, repetitive practice! hope this helps. :)

Explanation:

7 0
4 years ago
Read 2 more answers
1) (35 pts) For the curved lifting bar, calculate the stresses at A, B, and the centroid of the section.
Juliette [100K]

I know the Answer but first you should add me as Brainliest and I Will edit this to Answer.

3 0
3 years ago
The yield stress of a steel is 250Mpa. A steel rod used for implant in a femurneeds to withstand 29KN. What should the diameter
OleMash [197]

Answer:

r = 1.922 mm

Explanation:

We are given;

Yield stress; σ = 250 MPa = 250 N/mm²

Force; F = 29 KN = 29000 N

Now, formula for yield stress is;

σ = F/A

A = F/σ

Where A is area = πr²

Thus;

r² = 2900/250π

r² = 3.6924

r = √3.6924

r = 1.922 mm

3 0
3 years ago
Other questions:
  • Water flows through a horizontal plastic pipe with a diameter of 0.15 m at a velocity of 15 cm/s. Determine the pressure drop pe
    11·1 answer
  • A cylindrical specimen of a hypothetical metal alloy is stressed in compression. If its original and final diameters are 30.00 a
    14·1 answer
  • A circular hoop sits in a stream of water, oriented perpendicular to the current. If the area of the hoop is doubled, the flux (
    8·1 answer
  • What are the factors of production in business? Land, labor, and capital land, capital, and interest land, labor, and customer b
    10·2 answers
  • Technician A says that squeeze-type resistance spot welding (STRSW) may be used on open butt joints. Technician B says that repl
    14·1 answer
  • Air is compressed by a 30-kW compressor from P1 to P2. The air temperature is maintained constant at 25°C during this process as
    11·1 answer
  • The distribution of ground shaking around the fault
    5·1 answer
  • Hello , how are yall:))))
    10·2 answers
  • Which of the following is not a relationship set between elements in a sketch​
    7·1 answer
  • The centre of the circumstancribing circle of a triangle can be found by using the
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!