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
Do all websites use the same coding to create?
Sonbull [250]

Answer:

yes.

Explanation:

because all websites use coding

6 0
3 years ago
How buy airpods in my phone​
Levart [38]

U mean how to connect them to your phone?

4 0
2 years ago
Read 2 more answers
List the main activities of exploration??
Trava [24]

Answer:  Exploration includes plethora of activities and depend upon the kind  of exploration a person is doing. But most include some of the basic activities like research , investigation, planning and execution.

Suppose we want to explore new petroleum sites then we would have to start with studying the geography of that area, then according to our research we will analyse the hot spots or the sector where probability of finding of oil field is highest, post that appropriate man power is skilled professionals, tools and machinery will be brought at the site so that execution can take place.

3 0
3 years ago
A plate of an alloy steel has a plane-strain fracture toughness of 50 MPa√m. If it is known that the largest surface crack is 0.
Ivahew [28]

Answer:

option B is correct. Fracture will definitely not occur

Explanation:

The formula for fracture toughness is given by;

K_ic = σY√πa

Where,

σ is the applied stress

Y is the dimensionless parameter

a is the crack length.

Let's make σ the subject

So,

σ = [K_ic/Y√πa]

Plugging in the relevant values;

σ = [50/(1.1√π*(0.5 x 10^(-3))]

σ = 1147 MPa

Thus, the material can withstand a stress of 1147 MPa

So, if tensile stress of 1000 MPa is applied, fracture will not occur because the material can withstand a higher stress of 1147 MPa before it fractures. So option B is correct.

8 0
3 years ago
A 1000-turn coil of wire 1.0 cm in diameter is in a magnetic field that increases from 0.10 T to 0.30 T in 10 ms. The axis of th
ddd [48]

emf generated by the coil is 1.57 V

Explanation:

Given details-

Number of turns of wire- 1000 turns

The diameter of the wire coil- 1 cm

Magnetic field (Initial)= 0.10 T

Magnetic Field (Final)=0.30 T

Time=10 ms

The orientation of the axis of the coil= parallel to the field.

We know that EMF of the coil is mathematically represented as –

E=N(ΔФ/Δt)

Where E= emf generated

ΔФ= change inmagnetic flux

Δt= change in time

N= no of turns*area of the coil

Substituting the values of the above variables

=1000*3.14*0.5*10-4

=.0785

E=0.0785(.2/10*10-3)

=1.57 V

Thus, the emf generated is 1.57 V

4 0
3 years ago
Other questions:
  • What is the air change rate (ACH) for a 100 ft^2 (9.3 m^2) space with a 10 ft (3.0 m) ceiling and an airflow rate of 200 cfm (95
    12·1 answer
  • The kinetic energy correction factor depends on the (shape — volume - mass) of the cross section Of the pipe and the (velocity —
    11·1 answer
  • a sprue is 12 in long and has a diameter of 5 in at the top. The molten metal level in the pouring basing is taken to be 3 in fr
    13·2 answers
  • This manometer is used to measure the difference in water level between the two tanks.
    10·1 answer
  • A pool of contaminated water is lined with a 40 cm thick containment barrier. The contaminant in the pit has a concentration of
    11·1 answer
  • A heat pump with refrigerant-134a as the working fluid is used to keep a space at 25°C by absorbing heat from geothermal water t
    8·1 answer
  • A 200-gr (7000 gr = 1 lb) bullet goes from rest to 3300 ft/s in 0.0011 s. Determine the magnitude of the impulse imparted to the
    10·1 answer
  • Which of the followong parts does not rotate during starter operation? A. Commutator segments B. Armature windings c. Field wind
    10·1 answer
  • Structural engineers use wireless sensor networks to monitor the condition of dams and bridges.
    9·1 answer
  • . An ideal vapor compression refrigeration cycle operates with a condenser pressure of 900 kPa. The temperature at the inlet to
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!