In BlueJ using Java, write a program that can input and display a person’s family tree. This project requires a GUI class that allows the user to input the members of the family tree and print the family tree.
public class FTree
{
private class Node
{
String value;
Node left, right;
Node(String val)
{
value = val;
left = null;
right = null;
}
Node(String val, Node lChild, Node rChild)
{
value = val;
left = lChild;
right = rChild;
}
}
private Node root = null;
public boolean root(String x)
{
if (root == null){
root = new Node(x);
return true;}
else
return false;
}
public boolean addLeft(String p, String x)
{
Node parent = locate(p);
if (root == null ){
return false;}
else if (parent != null && parent.left == null){
parent.left = new Node(x);
return true;}
else
return false;
}
public boolean addRight(String p, String x)
{
Node parent = locate(p);
if (root == null ){
return false;}
else if (parent != null && parent.right == null){
//Adds node
parent.right = new Node(x);
return true;}
else
return false;
}
public Node locate(String p)
{
return locate(p, root);
}
private Node locate(String p, Node familyTree)
{
Node result = null;
if (familyTree == null)
return null;
if (familyTree.value.equals(p))
return familyTree;
if (familyTree.left != null)
result = locate(p,familyTree.left);
if (result == null)
result = locate(p,familyTree.right);
return result;
}
}
In BlueJ using Java, write a program that can input and display a person’s family tree....
Write a program in Java that will accept input and display a person's family tree. This program needs to have a root person that branches off to parents and grandparents and be made so that you can add people.
Write a java program that demonstrates recursion. This program can be in a java GUI frame or as a console application. On this one it is up to you. (It would probably work better as a console program for this particular program.) The input for this program is a number of boxes. Ask the user for this with a textbox or a prompt on the command line. Demonstrate recursion with a function called LoadTruck() that takes a number of boxes...
We are using blueJ for my java class, if you can help me id greatly appreciate it. Create a new Java program called Flip. Write code that creates and populates an array of size 25 with random numbers between 1-50. Print the array. Print array in reverse.
Java Programming Using BLUEJ Modify the Game Of War project so that the game can be played until a user specifies quitting from the keyboard. Hint: Add a Scanner object to the Driver class to read user input and a loop to repeat the play method. Driver-GameOfWar Class Edit Tools Options Driver × Compile Undo Cut Copy Paste Find... Close Source Code import java.util.Scanner; t A Driver to execute Game Of War program t@John Manz * @version (a version number or...
Write a Java Program to allow a user to guess a person’s age until they get it correct. After each guess, the user must be told whether their guess was correct, too high or too low. Once the user enters the correct age, the program must display how many guesses it took the user to guess the correct age.
We use bluej for our JAVA program. If you can help id greatly appreciate it. Create a new Java program called Flip. Write code that creates and populates an array of size 25 with random numbers between 1-50. Print the array. Print array in reverse.
We are using blueJ for my java class, if you can help me id greatly appreciate it. Create a new Java project/class called ChangeUp. Create an empty int array of size 6. Create a method called populateArray that will pass an array, use random class to choose a random index and prompt the user to enter a value, store the value in the array. Create a method called printArray that prints the contents of the array using the for each...
We are using blueJ for my java class, if you can help me id greatly appreciate it. Create a new Java project/class called ChangeUp. Create an empty int array of size 6. Create a method called populateArray that will pass an array, use random class to choose a random index and prompt the user to enter a value, store the value in the array. Create a method called printArray that prints the contents of the array using the for each...
Need help on following Java GUI problem: Write a program that lets a user display and modify pictures. Create a window. Add four buttons so that clicking a particular button will shift the image by a small amount in the north, south, east or west direction inside the window. Add a menu bar with two menus: File and Image. The File menu should contain an Open menu item that the user can select to display JPEG and PNG files from...
Write a simple java program that takes input from the user as a fully parenthesized expression and converts it to a binary tree. Ex: (1+2 * (6-4)) or (A+B / (D-C)) When the tree is built, it should print the tree in some way.