Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

import javafx.application.Application; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ButtonGroup; import javax.swing.JButton;...

1 answer below »
import javafx.application.Application;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextArea;
import javax.swing.JTextField;
public class Main {

JLabel l1,l2,l3,l4;
JTextField t1,t2,t3;
JRadioButton r1,r2,r3;
JButton Calculate;
JTextArea all;
Main(){

XXXXXXXXXXl1 = new JLabel("Invested Amount");
XXXXXXXXXXt1=new JTextField();

XXXXXXXXXXl2 = new JLabel("Rate of Interest");
XXXXXXXXXXt2=new JTextField();

XXXXXXXXXXl3 = new JLabel("Investment Years");
XXXXXXXXXXt3=new JTextField();

XXXXXXXXXXr1 = new JRadioButton ("Compounded Yearly");
XXXXXXXXXXr2 = new JRadioButton ("Compounded Half-Yearly ");
XXXXXXXXXXr3 = new JRadioButton ("Compounded Quarterly");

XXXXXXXXXXl4 = new JLabel("Frequency of Interest");

XXXXXXXXXXButtonGroup bg=new ButtonGroup();
XXXXXXXXXXbg.add(r1);
XXXXXXXXXXbg.add(r2);
XXXXXXXXXXbg.add(r3);

XXXXXXXXXXCalculate = new JButton("Calculate");
XXXXXXXXXXCalculate.addActionListener(this);

XXXXXXXXXXJPanel p1 = new JPanel();
XXXXXXXXXXp1.setLayout(new GridLayout(3,2));

XXXXXXXXXXp1.add(l1);
XXXXXXXXXXp1.add(t1);
XXXXXXXXXXp1.add(l2);
XXXXXXXXXXp1.add(t2);
XXXXXXXXXXp1.add(l3);
XXXXXXXXXXp1.add(t3);
XXXXXXXXXXp1.add(l4);


XXXXXXXXXXJPanel p2 = new JPanel();
XXXXXXXXXXp2.setLayout(new GridLayout(5,1));

XXXXXXXXXXp2.add(l4);
XXXXXXXXXXp2.add(r1);
XXXXXXXXXXp2.add(r2);
XXXXXXXXXXp2.add(r3);
XXXXXXXXXXp2.add(Calculate);

XXXXXXXXXXJPanel main = new JPanel();
XXXXXXXXXXmain.setLayout(new GridLayout(3,1));

XXXXXXXXXXall = new JTextArea();
XXXXXXXXXXmain.add(p1);
XXXXXXXXXXmain.add(p2);
XXXXXXXXXXmain.add(all);

XXXXXXXXXXsetTitle("Compoand Interest Calculator");
XXXXXXXXXXadd(main);
XXXXXXXXXXpack();
XXXXXXXXXXsetVisible(true);
XXXXXXXXXXsetSize(1000,1000);
XXXXXXXXXXsetLayout(null);
}
public static void main(String[] args) {
new Main();
}
@Ove
ide
public void actionPerformed(ActionEvent e) {

if(e.getActionCommand().equals("Calculate")) {
XXXXXXXXXXint p = Integer.parseInt(t1.getText());
XXXXXXXXXXdouble r = Double.parseDouble(t2.getText());
XXXXXXXXXXint t = Integer.parseInt(t3.getText());
XXXXXXXXXXint n = 0;

XXXXXXXXXXif(r1.isSelected())
XXXXXXXXXXn = 1;
XXXXXXXXXXif(r2.isSelected())
XXXXXXXXXXn = 2;
XXXXXXXXXXif(r3.isSelected())
XXXXXXXXXXn = 3;

XXXXXXXXXXInterest in = new Interest(p, r, n, t);
XXXXXXXXXXdouble interest = in.calculateInterest();
XXXXXXXXXXin.setI(interest);

XXXXXXXXXXall.setText(in.display());
}
}
}
import javafx.application.Application;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.lang.Math;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextArea;
import javax.swing.JTextField;
class Interest{
private int P;
private double r;
private double I;
private int n;
private int t;

public Interest(int p, double r, int n, int t) {
this.P = p;
this.r = r;
this.n = n;
this.t = t;
}

public void setP(int p) {
P = p;
}
public void setR(double r) {
this.r = r;
}
public void setI(double i) {
I = i;
}
public void setN(int n) {
this.n = n;
}
public void setT(int t) {
this.t = t;
}
double calculateInterest() {

double interest = (P * Math.pow XXXXXXXXXXr / 100)/ n)), n * t)) - P;
return interest;
}

String display() {
double total = P + I;
return "Prinicple Amount is : " + P + "\n Total Interest Earned is : " + I
+ "\n Total Amount is : " + total;
}
}
import javafx.application.Application;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.RadioButton;
import javafx.scene.control.TextField;
import javafx.scene.control.Toggle;
import javafx.scene.control.ToggleGroup;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.paint.Color;
import javafx.scene.text.Text;
import javafx.stage.Stage;
public class Fun extends Application {
XXXXXXXXXXButton leftButton, rightButton;
XXXXXXXXXXHBox color, messagebox;
XXXXXXXXXXRadioButton red, yellow, black, orange, green;
XXXXXXXXXXToggleGroup colorGroup;
XXXXXXXXXXBorderPane borderPane;
XXXXXXXXXXText message;
XXXXXXXXXXpublic void start(Stage stage) {
XXXXXXXXXXstage.setTitle("Programming is fun");
XXXXXXXXXXred = new RadioButton("Red");
XXXXXXXXXXyellow = new RadioButton("Yellow");
XXXXXXXXXXblack = new RadioButton("Black");
XXXXXXXXXXorange = new RadioButton("Orange");
XXXXXXXXXXgreen = new RadioButton("Green");
XXXXXXXXXXcolorGroup = new ToggleGroup();
XXXXXXXXXXred.setToggleGroup(colorGroup);
XXXXXXXXXXyellow.setToggleGroup(colorGroup);
Answered 5 days After Aug 11, 2021

Solution

Swapnil answered on Aug 16 2021
148 Votes
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.TextArea;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class Cart extends Application {

private String[] items = {"Potato", "Egg", "Chicken", "Milk", "Bread"};
private VBox centerPane;
private TextArea output;

@Ove
ide
public void start(Stage primaryStage) {
BorderPane root = new BorderPane();
Scene scene = new Scene(root,600,500);

centerPane = new VBox(20);
centerPane.setPadding(new Insets(20, 20,20, 20));
centerPane.setAlignment(Pos.CENTER);
root.setCenter(centerPane);



output = new TextArea();
output.setEditable(false);
HBox outputpane = new HBox(10, output);
outputpane.setAlignment(Pos.CENTER);
outputpane.setPadding(new Insets(25, 25, 25, 25));
centerPane.getChildren().add(output);


root.setBottom(outputpane);
primaryStage.setTitle("CART");
primaryStage.setScene(scene);
primaryStage.show();
primaryStage.setOnAction(setTitle("CART"));
primaryStage.setOnAction(setScene(scene));
primaryStage.setOnAction(setScene(scene));
primaryStage.show();
}
public static void main(String[] args)
{
launch(args);
}
}
void addToCart()
    {
        String pName;
        int found=0;
    
        System.out.println("Enter Product/Item Name :: ");
            pName=s1.next();
            
            Iterato
Product> i=a1.iterator();
            
            Set s=hm.entrySet();
            Iterator i1=s.iterator();
            
            
            while(i.hasNext())
            {
                Product...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here