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
Carnot heat engine A operates between 20ºC and 520ºC. Carnot heat engine B operates between 20ºC and 820ºC. Which Carnot heat en
nikklg [1K]

Answer:

engine B is more efficient.

Explanation:

We know that Carnot cycle is an ideal cycle for all working heat engine.In Carnot cycle there are four processes in which two are constant temperature processes and others two are isentropic process.

We also kn ow that the efficiency of Carnot cycle given as follows  

\eta =1-\dfrac{T_1}{T_2}

Here temperature should be in Kelvin.

For engine A

\eta =1-\dfrac{T_1}{T_2}

\eta =1-\dfrac{273+20}{520+273}

\eta =0.63

For engine B

\eta =1-\dfrac{T_1}{T_2}

\eta =1-\dfrac{273+20}{820+273}

\eta =0.73

So from above we can say that engine B is more efficient.

4 0
3 years ago
Ninety-five percent of the acetone vapor in an 85 vol.% air stream is to be absorbed by countercurrent contact with pure water i
Sati [7]

Answer:

Explanation:

.......................................................................................................................

5 0
3 years ago
B)
Triss [41]

Answer:

2.5 is the required details

8 0
3 years ago
An inventor claims to have developed a refrigerator that at steady state requires a net power input of 1.1 horsepower to remove
Lynna [10]

Answer:

The inventor's claim is false in the sense that no thermal machine can violate the first thermodynamic law.

Explanation:

The inventor's claim could not be possible as no thermal machine can transfer more heat than the input work consumed. If we expose the thermal efficiency:

n=Q out / W in

Where Q and W both must be in the same power unit, so we will convert the remove heat from BTU/hr to hp:

12000 BTU/hr = 4.72 hp

Therefore by comparing, we notice that the removing heat of 4.75 hp is large than the delivered work of 1.11 hp. By evaluating the efficiency:

[tex]n=4.75 hp / 1.1 hp  = 4.3 > 1[/tex]

6 0
3 years ago
Hiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
BartSMP [9]

Answer:

3. -9 degrees farenheit 5. Shes missing 3 cents. 6. 641 feet below sea level

Explanation:

3 0
3 years ago
Read 2 more answers
Other questions:
  • Please describe a real situation in which you had to troubleshoot and fix the failure of a piece equipment/machine?
    5·1 answer
  • 1000 lb boulder B is resting on a 500 lb platform A when truck C accidentally accelerates to the right (truck in reverse). Which
    15·1 answer
  • What is the one change that golden expects to see in public transportation?
    12·1 answer
  • It has been estimated that 139.2x10^6 m^2 of rainforest is destroyed each day. assume that the initial area of tropical rainfore
    12·1 answer
  • As described in "A Note About Bacterial Reproduction -- and the "Culture Bias,"" the organism Epulopisciumdoes not divide by bin
    12·1 answer
  • A round bar of chromium steel, (ρ= 7833 kg/m, k =48.9 W/m-K, c =0.115 KJ/kg-K, α=3.91 ×10^-6 m^2/s) emerges from a heat treatmen
    14·1 answer
  • How to update android 4.4.2 to 5.1 if there isnt any update available​
    15·2 answers
  • When was solar power envold ​
    8·2 answers
  • Seperate real and imaginary parts tan(2x+i3y)
    15·1 answer
  • You have three gear wheels a, b and c connected to each other,if you turn the first gear wheel "a" clockwise what will happen to
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!