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
Using Von Karman momentum integral equation, find the boundary layer thickness, the displacement thickness, the momentum thickne
Alex_Xolod [135]

Answer:

Explanation:

We can solve Von Karman momentum integral equation as seen below using following in the attached file

3 0
3 years ago
Consider a simple ideal Rankine cycle and an ideal regenerative Rankine cycle with one open feedwater heater. The two cycles are
borishaifa [10]

Answer:

They both have the same efficiency.

Explanation:

The simple ideal Rankine cycle and an ideal regenerative Rankine cycle with one open feedwater heater would both have the same efficiency because the extraction steam would just create a mini cycle that recirculates. The energy given to the feedwater heater is proportional to the added heat in the boiler to the feedwater in the simple cycle to raise its temperature to the same boiler inlet condition.

Therefore in comparison, the efficiency is the same for both.

4 0
3 years ago
The toggle (t) flip-flop has one input, clk, and one output, q. on each rising edge of clk, q toggles to the complement of its p
jeyben [28]

Answer:

  See attached

Explanation:

The next state of a toggle flip-flop is the inverse of the present state. This behavior can be produced using a D flip-flop that has its input connected to the inverse of its output.

__

A schematic is attached.

7 0
2 years ago
Two engineers are to solve an actual heat transfer problem in a manufacturing facility. Engineer A makes the necessary simplifyi
deff fn [24]

Answer:

Engineer A results will be more accurate

Explanation:

Analytical method is better than numerical method. Engineer A has used analytical method and therefore his results will be more accurate because he used simplified method. Engineer B has used software to solve the problem related to heat transfer his results will be approximate.

5 0
3 years ago
Instead of running blood through a single straight vessel for a distance of 2 mm, one mammalian species uses an array of 100 tin
Marina CMI [18]

Solution:

Given that :

Volume flow is, $Q_1 = 1000 \ mm^3/s$

So, $Q_2= \frac{1000}{100}=10 \ mm^3/s$

Therefore, the equation of a single straight vessel is given by

$F_{f_1}=\frac{8flQ_1^2}{\pi^2gd_1^5}$    ......................(i)

So there are 100 similar parallel pipes of the same cross section. Therefore, the equation for the area is

$\frac{\pi d_1^2}{4}=1000 \times\frac{\pi d_2^2}{4} $

or $d_1=10 \ d_2$

Now for parallel pipes

$H_{f_2}= (H_{f_2})_1= (H_{f_2})_2= .... = = (H_{f_2})_{10}=\frac{8flQ_2^2}{\pi^2 gd_2^5}$  ...........(ii)

Solving the equations (i) and (ii),

$\frac{H_{f_1}}{H_{f_2}}=\frac{\frac{8flQ_1^2}{\pi^2 gd_1^5}}{\frac{8flQ_2^2}{\pi^2 gd_2^5}}$

       $=\frac{Q_1^2}{Q_2^2}\times \frac{d_2^5}{d_1^5}$

       $=\frac{(1000)^2}{(10)^2}\times \frac{d_2^5}{(10d_2)^5}$

       $=\frac{10^6}{10^7}$

Therefore,

$\frac{H_{f_1}}{H_{f_2}}=\frac{1}{10}$

or $H_{f_2}=10 \ H_{f_1}$

Thus the answer is option A). 10

7 0
3 years ago
Other questions:
  • To cool a summer home without using a vapor compression refrigeration cycle, air is routed through a plastic pipe (k=0.15 W/m*K,
    15·1 answer
  • Calculate the value of ni for gallium arsenide (GaAs) at T = 300 K. The constant B = 3. 56 times 1014 9cm -3 K-3/2) and the band
    9·1 answer
  • Air enters a compressor operating at steady state at 176.4 lbf/in.^2, 260°F with a volumetric flow rate of 424 ft^3/min and exit
    10·1 answer
  • The value of the critical Reynolds number for the flow over a flat plate is 5 x10^5. The significance of the value is:
    13·1 answer
  • Consider five wireless stations A,B,C,D,E. Station
    5·2 answers
  • Q1. Basic calculation of the First law (2’) (a) Suppose that 150 kJ of work are used to compress a spring, and that 25 kJ of hea
    6·1 answer
  • Hey any one ride dirtbikes here
    5·2 answers
  • What do Engineering Systems achieve?
    8·1 answer
  • Explain how you would solve for total resistance in a parallel circuit versus a series circuit. How would you apply and solve fo
    10·1 answer
  • Which type of line is represented by thin, short dashes?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!