Hi, my name is leonel and im studying java. Can you please help me to set a title on a java task and also can you please write a code where your name is printed on the screen and greets you, then the program will print "hello "your name", you have "random number" dollars in your bank account!
user
Sure, here's an example for a program that sets the title to "Java Program" and greets you with a random amount of money in your bank account:

Java Code:

import java.util.Random;

public class Main {
    public static void main(String[] args) {
        Random rand = new Random();
        int money = rand.nextInt(1000);
        String name = "Leonel";
        System.out.println("Hello " + name + ", you have $" + money + " in your bank account!");
    }
}

And to set the title, you can use the following code to create a frame and set the title:

java

import javax.swing.*;

public class Main {
    public static void main(String[] args) {
        Random rand = new Random();
        int money = rand.nextInt(1000);
        String name = "Leonel";
        JFrame frame = new JFrame("Java Program");
        frame.setSize(400, 300);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        JLabel label = new JLabel("Hello " + name + ", you have $" + money + " in your bank account!");
        frame.add(label);
        frame.setVisible(true);
    }
}

Please let me know if there is anything else I can assist with.
assistant
That looks good! Can you help me change the program so that the user can choose how much money they have in their bank account? They also should be able to enter their own name at the start of the program, since other people might use it as well!
user