Question
the first question java code eclipse app
the second question is java fx gui caculator
please fast

1. Create project called YourFirstName_QUID. Eg. Aliomar_202002345 2. Create two package Q1 and Q2. 3. Add your name and st
CMPS 251-FinalExamV1 _002_ (1) (Protected View) - Microsoft Word (Product Activation F Review View lings and might be unsafe.
1.4 Ballroom Class 10 Points 1. Create a class named Ballroom subclass of Reservation. 2. The class has attributes as shown i

Microsoft Word (Product Activation Failed) t Page Layout References Mailings Review View file originated from an Internet loc

CMPS 251 FinalExamV1_002 (1) (Protect Review View Home Insert Page Layout References Mailings tected View This file originate
View) - Microsoft Word (Product Activation Failed) Cust a s 1645. A Reservation Type Ballroom Reservation Date 22-04-20 Beltr
10 Home CMPS 251-FinalExamV1_002_ (1) (Protected Review View Insert Page Layout References Mailings rotected View This file o
0 0
Add a comment Improve this question Transcribed image text
Answer #1

I am attaching the codes along with file names pls write the code to u r editor with the name of the files provided

first file name : BMI.fxml

code the above file

<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.text.*?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>

<AnchorPane id="AnchorPane" prefHeight="480.0" prefWidth="412.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8" fx:controller="bmi.BMIController">
<children>
<Button fx:id="button" layoutX="155.0" layoutY="272.0" onAction="#handleButtonAction" text="Calculate" />
<Label fx:id="label" alignment="CENTER" layoutX="14.0" layoutY="381.0" minHeight="16" minWidth="69" prefHeight="64.0" prefWidth="180.0" text="0.0">
<font>
<Font name="System Bold Italic" size="24.0" />
</font></Label>
<TextArea layoutX="193.0" layoutY="319.0" prefHeight="147.0" prefWidth="206.0" text="BMI VALUES&#10;Underweight:&#9;less than 18.5&#10;Normal:&#9;&#9;between 18.5 and 24.9&#10;Overweight:&#9;between 25 and 29.9&#10;Obese:&#9;&#9;30 or greater&#10;">
<font>
<Font size="11.0" />
</font>
</TextArea>
<TextField fx:id="weight" layoutX="110.0" layoutY="145.0" />
<TextField fx:id="height" layoutX="110.0" layoutY="213.0" />
<RadioButton fx:id="pi" layoutX="60.0" layoutY="47.0" mnemonicParsing="false" selected="true" text="Pounds-Inches">
<toggleGroup>
<ToggleGroup fx:id="ip" />
</toggleGroup>
</RadioButton>
<RadioButton fx:id="km" layoutX="227.0" layoutY="47.0" mnemonicParsing="false" text="Kilograms-Meters" toggleGroup="$ip" />
<Label layoutX="119.0" layoutY="117.0" text="Weight" />
<Label layoutX="119.0" layoutY="190.0" text="Height" />
<Label layoutX="28.0" layoutY="319.0" prefHeight="50.0" prefWidth="152.0" text="Your BMI is:">
<font>
<Font size="24.0" />
</font>
</Label>
</children>
</AnchorPane>

<?xml version=1.0 encoding=UTF-8?> <?import javafx.scene.text.*?> <?import java.lang.*?> <?import java.util.*?> <?import</TextArea> <TextField fx:id=weight layoutX=110.0 layouty=145.0 /> <TextField fx:id=height layoutX=110.0 layouty=2

second file name : BMI.java

Code for second file

package bmi;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;

/**
*
* @author AbhinavTyagi
*/
public class BMI extends Application {
  
@Override
public void start(Stage stage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("BMI.fxml"));
  
Scene scene = new Scene(root);
stage.setTitle("BMI CALCULATOR");
stage.setScene(scene);
stage.show();
}

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
  

package bmi; import javafx.application. Application; import javafx.fxml. FXMLLoader; import javafx.scene.Parent; import javaf* @param args the command line arguments */ public static void main(String[] args) { launch(args);

third file name : BMIController.java

code for bmicontroller

package bmi;

import java.net.URL;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Label;
import javafx.scene.control.RadioButton;
import javafx.scene.control.TextField;

/**
*
* @author AbhinavTyagi
*/
public class BMIController implements Initializable {
  
@FXML
private Label label;
@FXML
private RadioButton pi;
@FXML
private RadioButton km;
@FXML
private TextField weight;
@FXML
private TextField height;
  
  
  
@FXML
private void handleButtonAction(ActionEvent event) {
try{
Double w = new Double(weight.getText());
Double h = new Double(height.getText());
Double bmi;
  
if(pi.isSelected()){
bmi = (w * 703.0)/(h*h);
label.setText(String.format("%.2f",bmi));
}
else if(km.isSelected()) {
bmi = w /(h*h);
label.setText(String.format("%.2f",bmi));
}
  
}catch(NumberFormatException nf){
weight.setText("Enter valid value");
weight.selectAll();
weight.requestFocus();
height.setText("Enter valid value");
height.selectAll();
  
}
  
}
  
@Override
public void initialize(URL url, ResourceBundle rb) {
// TODO
}
  

package bmi; import java.net.URL; import java.util. ResourceBundle; import javafx.event.ActionEvent; import javafx.fxml. FXML@FXML private TextField weight; OFXML private TextField height; @FXML private void handleButtonAction(ActionEvent event) { tr}catch (NumberFormatException nf) { weight.setText(Enter valid value); weight. selectAll(); weight.request Focus(); height.


<?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.text.*?> <?import java.lang.*?> <?import java.util.*?> '<?import javafx.scene.*?> <?import javafx.scene.control.*?> '<?import javafx.scene.layout.*?> <Anchor Pane id="AnchorPane" prefHeight="480.0" prefWidth="412.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http:// javafx.com/javafx/8" fx:controller="bmi. BMI Controller"> <children> <Button fx:id="button" layoutx="155.0" layoutY="272.0" onAction="#handleButtonAction" text="Calculate" /> <Label fx:id="label" alignment="CENTER" layoutX="14.0" layoutY="381.0" minHeight="16" minWidth="69", prefHeight="64.0" prefWidth="180.0" text="0.0"> <font> <Font name="System Bold Italic" size="24.0" /> </font></Label> <TextArea layoutX="193.0" layoutY="319.0" prefHeight="147.0" prefWidth="206.0" text="BMI VALUES&#10;Underweight:&#9;less than 18.5&#10; Normal:&#9;&#9; between 18.5 and 24.9&#10;overweight:&#9; between 25 and 29.9&#10;Obese:&#9;&#9;30 or greater&#10;"> <font> '<font size="11.0" /> </font>

</TextArea> <TextField fx:id="weight" layoutX="110.0" layouty="145.0" /> <TextField fx:id="height" layoutX="110.0" layouty="213.0" /> <RadioButton fx:id="pi" layoutx="60.0" layouty="47.0" mnemonicParsing="false" selected="true" text="Pounds-Inches"> <toggleGroup> '<ToggleGroup_fx:id="ip" /> </toggleGroup> </RadioButton> <RadioButton fx:id="km" layoutX="227.0" layoutY="47.0" mnemonicParsing="false" text="Kilograms-Meters" toggleGroup="$ip" /> <Label layoutX="119.0" layoutY="117.0" text="Weight" /> <Label layoutX="119.0" layoutY="190.0" text="Height" /> <Label layoutX="28.0" layoutY="319.0" prefHeight="50.0" prefWidth="152.0"text="Your BMI is:"> <font> <font size="24.0"/> </font> </Label> </children> </AnchorPane>

package bmi; import javafx.application. Application; import javafx.fxml. FXMLLoader; import javafx.scene.Parent; import javafx.scene. Scene; import javafx. stage. Stage; /** * * Cauthor AbhinavTyagi * public class BMI extends Application { @Override public void start(Stage stage) throws Exception { Parent root = FXMLLoader.load(getClass().getResource("BMI. fxml")); Scene scene = new Scene(root); stage.setTitle("BMI CALCULATOR"); stage.setScene(scene); stage.show();

* @param args the command line arguments */ public static void main(String[] args) { launch(args);

package bmi; import java.net.URL; import java.util. ResourceBundle; import javafx.event.ActionEvent; import javafx.fxml. FXML; import javafx.fxml. Initializable; import javafx.scene.control.Label; import javafx.scene.control.RadioButton; import javafx.scene.control. TextField; /** * * * Cauthor AbhinavTyagi */ public class BMIController implements Initializable { OFXML private Label label; OFXML 'private RadioButton pi; @FXML private RadioButton km;

@FXML private TextField weight; OFXML private TextField height; @FXML private void handleButtonAction(ActionEvent event) { try{ Double w = new Double(weight.getText()); Double h = new Double(height.getText()); Double bmi; if(pi.isSelected() { bmi = (w * 703.0)/(h*h); label.setText(String.format("%.2f", bmi)); else if(km.isSelected()) { bmi = w /(h*h); label.setText(String.format("%.2f", bmi));

}catch (NumberFormatException nf) { weight.setText("Enter valid value"); weight. selectAll(); weight.request Focus(); height.setText("Enter valid value"); height.selectAll(); @Override public void initialize(URL url, ResourceBundle rb) { // TODO

Add a comment
Know the answer?
Add Answer to:
the first question java code eclipse app the second question is java fx gui caculator please...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a program in Java, Python and Lisp When the program first launches, there is a...

    Write a program in Java, Python and Lisp When the program first launches, there is a menu which allows the user to select one of the following five options: 1.) Add a guest 2.) Add a room 3.) Add a booking 4.) View bookings 5.) Quit The functionality of these options is as follows: 1.) When users add a guest they provide a name which is stored in some manner of array or list. Guests are assigned a unique ID...

  • making a file You are tasked with creating a text-based program for storing data on Hotel...

    making a file You are tasked with creating a text-based program for storing data on Hotel Room Bookings - however, as this is a comparative languages course, you will be creating the same application in the following three programming languages: • Java, • Python, and • Lisp As you implement the application in each language you should keep notes on: - The features of the languages used, - Which features you found useful, and - Any issues or complications which...

  • Please help with a source code for C++ and also need screenshot of output: Step 1:...

    Please help with a source code for C++ and also need screenshot of output: Step 1: Create a Glasses class using a separate header file and implementation file. Add the following attributes. Color (string data type) Prescription (float data type) Create a default constructor that sets default attributes. Color should be set to unknown because it is not given. Prescription should be set to 0.0 because it is not given. Create a parameterized constructor that sets the attributes to the...

  • There are a sotall of five classes and one enum required for this project. Over the...

    There are a sotall of five classes and one enum required for this project. Over the course of the projeet, it is important that you pay attention to how different responsibilities are separaled between the classes and how they work in coejuncticn to handle a probiem A quick list of the necessary items for this peogram are HotelManagement Class This is the driver class foe your peogram It will cntain a methed for setting up an initial hotel and the...

  • Please try to write the code with Project 1,2 and 3 in mind. And use java language, thank you very much. Create an Edit Menu in your GUI Add a second menu to the GUI called Edit which will have one me...

    Please try to write the code with Project 1,2 and 3 in mind. And use java language, thank you very much. Create an Edit Menu in your GUI Add a second menu to the GUI called Edit which will have one menu item called Search. Clicking on search should prompt the user using a JOptionPane input dialog to enter a car make. The GUI should then display only cars of that make. You will need to write a second menu...

  • In Java Code Needed is Below the Question Using Program 3: Encapsulating Dogs, modify this program...

    In Java Code Needed is Below the Question Using Program 3: Encapsulating Dogs, modify this program to create a database of dogs of your own. You will also include File I/O with this program. You will create 3 classes for this assignment. The first class: Create a Class representing the information that is associated with one item (one dog) of your database. Name this class Dog. Using Lab 3, this will include the information in regard to one dog. The...

  • no buffered reader. no try catch statements. java code please. And using this super class: Medialtemjava...

    no buffered reader. no try catch statements. java code please. And using this super class: Medialtemjava a Create the "middle" of the diagram, the DVD and ForeignDVD classes as below: The DVD class will have the following attributes and behaviors: Attributes (in addition to those inherited from Medialtem): • director:String • rating: String • runtime: int (this will represent the number of minutes) Behaviors (methods) • constructors (at least 3): the default, the "overloaded" as we know it, passing in...

  • 1- Write a code for a banking program. a) In this question, first, you need to...

    1- Write a code for a banking program. a) In this question, first, you need to create a Customer class, this class should have: • 2 private attributes: name (String) and balance (double) • Parametrized constructor to initialize the attributes • Methods: i. public String toString() that gives back the name and balance ii. public void addPercentage; this method will take a percentage value and add it to the balance b) Second, you will create a driver class and ask...

  • JAVA PROGRAM USING ECLIPSE. THE FIRST IMAGE IS THE INSTRUCTIONS, THE SECOND IS THE OUTPUT TEST...

    JAVA PROGRAM USING ECLIPSE. THE FIRST IMAGE IS THE INSTRUCTIONS, THE SECOND IS THE OUTPUT TEST CASES(WHAT IM TRYING TO PRODUCE) BELOW THOSE IMAGES ARE THE .JAVA FILES THAT I HAVE CREATED. THESE ARE GeometircObject.Java,Point.java, and Tester.Java. I just need help making the Rectangle.java and Rectangle2D.java classes. GeometricObject.Java: public abstract class GeometricObject { private String color = "white"; // shape color private boolean filled; // fill status protected GeometricObject() { // POST: default shape is unfilled blue this.color = "blue";...

  • Note: According to the question, please write source code in java only using the class method....

    Note: According to the question, please write source code in java only using the class method. Sample Run (output) should be the same as displayed in the question below. Make sure the source code is working properly and no errors.​ Exercise #2: Design and implement class Radio to represent a radio object. The class defines the following attributes (variables) and methods Assume that the station and volume settings range from 1 to 10 1. A private variable of type int...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT