CS 2323 – HW 09 1) (Histogram) Write a program that lets the user enter a text. Clicking the Show Histogram button displays the occurrences of the letters in the text in a histogram, as shown below....

1 answer below »
pfa


CS 2323 – HW 09 1) (Histogram) Write a program that lets the user enter a text. Clicking the Show Histogram button displays the occurrences of the letters in the text in a histogram, as shown below. The number of occurrences of each letter is displayed in a bar chart. Use a separate stage to displayte histogram. 2) (Manipulate list) Write a program that displays a list view and a text field. The user can add a string to the list view by entering a string in the text field, as shown. The user can also delete a string from the list view by selecting a string and pressing the Delete button, as shown here 3) (Retrieve files from Web) Write a Java program that retrieves a file from a Web server, as shown in Figure 16.7. The user interface includes a text field in which to enter the URL of the file name, a text area in which to show the file, and a button that can be used to submit an action. A label is added at the bottom of the pane to indicate the status, such as File loaded successfully or Network connection problem. Grading Criteria Histogram 1 Display JavaFX window 1 Display Editable Texbook 1 Calculate letter frequency 1.4 Button displays Histogram 1.2 Documentation Manipulate list 1 Display JavaFX window 1.5 Add String 1.5 Delete String 1.2 Documentation Retrieve File 1 Display JavaFX window 1 Read URL address 1 Read file from URL 1 Display Contents of File 1.2 Documentation
Answered 11 days AfterJun 30, 2021

Answer To: CS 2323 – HW 09 1) (Histogram) Write a program that lets the user enter a text. Clicking the Show...

Vishal answered on Jul 12 2021
144 Votes
Solution1/Histogram.java
Solution1/Histogram.java
package com.histogram;
import java.util.ArrayList;
import java.util.List;
import javafx.application.*;
import javafx.collections.*;
impo
rt javafx.event.*;
import javafx.geometry.*;
import javafx.scene.*;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.scene.paint.*;
import javafx.scene.shape.*;
import javafx.scene.text.*;
import javafx.stage.*;
public class Histogram extends Application {

//Implenentation of start function
     @Override
    public void start(Stage primaryStage) {
        VBox vbox = new VBox();
        //call setSpacing function
        vbox.setSpacing(10);
        TextArea textObject = new TextArea();
        textObject.setMaxSize(380, 200);
        textObject.setWrapText(true);
        //Create an object for Button class
        Button btObject = new Button();
        //call setText function
        btObject.setText("Show Histogram");
        vbox.setAlignment(Pos.CENTER);
        vbox.getChildren().addAll(textObject, btObject);
        Scene scene = new Scene(vbox, 400, 220);
        //call setTitle function
        primaryStage.setTitle("Exercise16_10");
        primaryStage.setScene(scene);
        //call show function
        primaryStage.show();
        double prefSize = 10;
        ScrollBar vertScrollBar = (ScrollBar) textObject.lookup(".scroll-bar:vertical");
        ScrollBar horizScrollBar = (ScrollBar) textObject.lookup(".scroll-bar:horizontal");
        vertScrollBar.setPrefWidth(prefSize);
        horizScrollBar.setPrefWidth(prefSize);
        //Implementation of setOnAction function
        btObject.setOnAction((ActionEvent event) -> {
            String inputString = textObject.getText();
            int[] numbers = new int[26];
            inputString = inputString.toLowerCase();
            int[] frequency = new int[26];
            for (...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here