Question

Need JAVA code for the following question. I am using Eclipse IDE. Ratings will be given...

Need JAVA code for the following question. I am using Eclipse IDE. Ratings will be given to the correct answer. Send the code and screenshots of the program running.

2.) Name Formatter

Create a JavaFX application that lets the user enter the following pieces of data:

- The user's first name
- The user's middle name
- The user's last name
- The user's preferred title (Mr., Mrs., Ms., Dr., and so on.)

Assume the user has entered the following data:
- First name: Kelly
- Middle name: Jane
- Last name: Smith
-Title: Ms.

The application should have buttons that display the user's name formatted in the following ways:
- Ms. Kelly Jane Smith
- Kelly Jane Smith
- Kelly SMith
- Smith, Kelly Jane, Ms.
- Smith, Kelly Jane
- Smith, Kelly

0 0
Add a comment Improve this question Transcribed image text
Answer #1

package application;   
import java.util.Scanner;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
public class Hello_World extends Application{
  
@Override
public void start(Stage primaryStage) throws Exception {
// TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
System.out.print("First name: ");
String first_name=sc.next();
System.out.print("Middle name: ");
String middle_name=sc.next();
System.out.print("Last name: ");
String last_name=sc.next();
System.out.print("Title: ");
String title=sc.next();
Button btn1=new Button(title+" "+first_name+" "+middle_name+" "+last_name);
Button btn2=new Button(first_name+" "+middle_name+" "+last_name);
Button btn3=new Button(first_name+" "+last_name);
Button btn4=new Button(last_name+", "+first_name+" "+middle_name+", "+title);
Button btn5=new Button(last_name+", "+first_name+" "+middle_name);
Button btn6=new Button(last_name+", "+first_name);
VBox root=new VBox();
root.getChildren().addAll(btn1,btn2,btn3,btn4,btn5,btn6);
Scene scene=new Scene(root,600,400);
primaryStage.setTitle("First JavaFX Application");
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args)
{
launch(args);
}
}
/*
OUTPUT:-
First name: Kelly
Middle name: Jane
Last name: Smith
Title: Ms.

First JavaFX Application Ms. Kelly Jane Smith Kelly Jane Smith Kelly Smith Smith, Kelly Jane, Ms. Smith, Kelly Jane Smith, Kelly
*/

Add a comment
Know the answer?
Add Answer to:
Need JAVA code for the following question. I am using Eclipse IDE. Ratings will be given...
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
  • Your task for this project is to write a parser for a customer form. You need to develop a Java a...

       Your task for this project is to write a parser for a customer form. You need to develop a Java application using Parboiled library. Your program should include a grammar for the parser and display the parse tree with no errors. Remember that your fifth and sixth assignments are very similar to this project and you can benefit from them. The customer form should include the following structure: First name, middle name (optional), last name Street address, city, state (or...

  • Java Inventory Management Code Question

    Inventory ManagementObjectives:Use inheritance to create base and child classesUtilize multiple classes in the same programPerform standard input validationImplement a solution that uses polymorphismProblem:A small electronics company has hired you to write an application to manage their inventory. The company requested a role-based access control (RBAC) to increase the security around using the new application. The company also requested that the application menu must be flexible enough to allow adding new menu items to the menu with minimal changes. This includes...

  • JavaFX! Just need to fill several lanes of code please!!! CSE205 OOP and Data Structure Quiz #15 Last Name (print) First Name (print) Write a JavaFX GUI application program that simulates a timer. T...

    JavaFX! Just need to fill several lanes of code please!!! CSE205 OOP and Data Structure Quiz #15 Last Name (print) First Name (print) Write a JavaFX GUI application program that simulates a timer. The timer should show "count: the beginning and increase the number by 1 in every one second, and so on. o" at .3 A Timer - × A Timer Count: 0 Count: 1 (B) After 1 second, the GUI Window (A) Initial GUI Window According to the...

  • I need the following written in Java please, thank you ' We want you to implement...

    I need the following written in Java please, thank you ' We want you to implement a java class that will show details on users and throw exceptions where needed. The following requirements specify what fields you are expected to implement in your User class: - A private String firstName that specifies the first name of the user - A private String lastName that specifies the last name of the user - A private int age that specifies user's age...

  • I need help with the following. I need to write a program code in Java using...

    I need help with the following. I need to write a program code in Java using NetBeans. It is from How to Program Java book Chapter 2. This program should calculate the packing of Candles. First read: The number of candles The number of candles that fit in each case Then calculate and print: The number of full cases The number of candles left over (partial case) If this order is large (more than 5 full cases needed) An extra...

  • the first question java code eclipse app the second question is java fx gui caculator please...

    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 studentID as comments on the top of each Java source file you submit. Question 1. Bookings APP [80 Points-six parts] Implement the following hotel booking system. Use the following class diagram to understand the structure of the system's classes, their attributes operations (or methods),...

  • JAVA... QUESTION 3 IS A CONTINOUS TO Q2 CAN YOU SEND THE CODE SEPARATELY FOR EACH...

    JAVA... QUESTION 3 IS A CONTINOUS TO Q2 CAN YOU SEND THE CODE SEPARATELY FOR EACH Q , I BE SO THANKFUL Q2. Implement a program to store the applicant’s information for a visa office. You need to implement the following: A super class called Applicant, which has the following instance variables: A variable to store first name of type String. A variable to store last name of type String. A variable to store date of birth, should be implemented...

  • Java: student directory GUI You need to implement three classes: Person Student StudentDirectory StudentMain Start by...

    Java: student directory GUI You need to implement three classes: Person Student StudentDirectory StudentMain Start by implementing Person and Student classes. Once you are sure you can serialize and deserialize and ArrayList of Students to and from a file, move on to building the GUI application. Person: The Person class should implement serializable interface. It contains the following: Person's first name (String) Person's last name (String) Person's id number Person's date of birth (Date) public String toString(): This method method...

  • Help Please on JAVA Project: Validating the input is where I need help. Thank you Requirements...

    Help Please on JAVA Project: Validating the input is where I need help. Thank you Requirements description: Assume you work part-time at a sandwich store. As the only employee who knows java programming, you help to write a sandwich ordering application for the store. The following is a brief requirement description with some sample output. 1. Selecting bread When the program starts, it first shows a list/menu of sandwich breads and their prices, then asks a user to select a...

  • I need help with this assignment in C++, please! *** The instructions and programming style detai...

    I need help with this assignment in C++, please! *** The instructions and programming style details are crucial for this assignment! Goal: Your assignment is to write a C+ program to read in a list of phone call records from a file, and output them in a more user-friendly format to the standard output (cout). In so doing, you will practice using the ifstream class, I'O manipulators, and the string class. File format: Here is an example of a file...

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