Showing posts with label Apps. Show all posts
Showing posts with label Apps. Show all posts

Composition: exchanging information between objects

One of the best tricks of Java programming language is the communication between its elements, variables, methods, objects, classes, and things we will see later. More than that, what's great is that we can control that communication, it can be: public, private and protected. 

In this tutorial, we will start this communication, talking about the Composition, which is simply the act of passing an object to another, to use its methods or attributes. 

Application: Simulation simple bank account

Application: Bank account / ATM simple Java 

Create a prototype of an ATM in Java programming language. Earlier, it asks your name and initial value in the account. The program must provide a 4-digit number - account number - to the user (use Random). These data will be used to create an object of class "ATM.java" 

Then, shows a menu with options (this menu should be a method): 
- Bank Statementt: displays the name, account number, balance, and how many operations have been performed 
- Withdraw: get the amount to be withdrawn, reports can be drawn up (can not be negative) and shows the balance 
- Deposit: receives the amount to be deposited and shows the new balance 
- Exit 

This menu appears until the user chooses to exit. The other options are methods that should be part of the "ATM.java" (getters and setters). Note that the user can withdraw at most 5 times per day. 

How to make a Tic Tac Toe (noughts and crosses) game in Java


Learn how to make the Tic Tac Toe game in Java! Commented and well explained code!It's time to put our knowledge into practice to do something really cool and useful:
The Tic Tac Toe game in Java! Also known as noughts and crosses!

This is a simple version, to be played with two people. Note that in a simple Java application like this, the result came out around 300 lines of code.

If you are Java programmer, click to see the full commented code and explanation about the Tic Tac Toe Java Game creation.

Yes, there is a strategy we can adopt (or the computer may adopt) to never lose a game of tic tac toe:
http://en.wikipedia.org/wiki/Tic-tac-toe

Building your Java project into executable in NetBeans


Okay, you created your graphics application abd already knows how to do multiple applications.

But you want to show to the whole world yours fantatics programs, how to do? Will send the project folder to the others? Will send them to download NetBeans to run yours programs in Java?

Of course not. You have to do the build and send your program all ready to be used for the world.
We will show how to make yours Java project in executables.

Graphical Application: shows the roots of a quadratic equation in Java

Java exercise using Dialog Box:

Write a program that receives the coefficients of a quadratic equation and returns its roots, even complex ones, through dialog boxes.

Lear how to create a graphical application that calculate the roots of a quadratic equation

App: Simple menu using methods, loops and switch

How to make a simple menu in Java, using methods, loops and switch statement commandUsing a method to display a menu of options

Focusing on the goal of our Java course, and show that it is doing useful things, we show a utility method that simply display messages on the screen.

Commented and explained code of Minesweeper game in Java



We will now explain in detail how to do, and understand all program logic of a minesweeper game in the Java programming language.

The game code is on our last article of our online course Java:
Game: How to make a Minesweeper in Java



Game: How to make a Minesweeper in Java


Continuing the games we're doing, and teaching how to do, now we'll show you how to program the famous Minesweeper game in Java.

If you did not follow the other game made in our Java course, see:
  How to make the game Battleship in Java

Here we show the classes and game code, in the next article we will explain in detail how to program the game:

Commented and explained code of Minesweeper game in Java

Basic Topics in Java Programming

 Basic Topics in Java Programming


    01. The necessary to start programming: installing JDK and NetBeans
    02. Creating the first program in Java
       2.1 Commented code of the first program - what Classes and Methods are
    03. Printing on screen using print, println and printf
       3.1 Exercises about printing outputs
    04. Comments and Delimiters
    05. Numeric Types - byte, short, int, long, float and double
    06. Getting user data: class Scanner
          Video lesson: How to use the Scanner Class
    07. Math: Addition, Subtraction, Multiplication, Division, Division Rest (module) and operator precedence in Java
    08. Comparisons: operators greater than (>), less than (<), greater equal (>=), less equal (<=), equal (==) and different (=)
    09. Char type: storing and representing characters
    10. Boolean type: the Base of Computer Logic
    11. The logical operators and denial: && (AND), || (OR) and! (negation)

    Battleship game in Java: How to program


    How to make a Battleship game in Java. Commented and explained code in step-to-step for Java beginnersNow, that we already learned how to pass arrays (of any size) for methods, we can do something more useful. Let's do the famous game called naval battle, in text mode.

    We use everything we have learned so far in our Java course: if else, while loop, loop, methods, random numbers, arrays, multidimensional arrays and creativity.

    Application: Determines the roots of a second degree equation



    Create a program in Java, which receives the coefficients of an equation of the second degree and return their roots.

    A quadratic equation is an equation where:
    ax ² + bx + c = 0, with 'a' different from 0


    How to use the JColorChooser | Progressive Java



    Do ou know those color options, transparency, hue, brightness, etc., that you see on image programs out there?

    Yes you can put in your Java application too.
    But don't fear, is quite simple. Everything is ready, and the name of it is JColorChooser.


    Java, Program: Say if you got straight approval, or have to do recovery test or failed


    Problem: Create a program that receives a grade (use Scanner class) and check if you got approved straight, have to do a test recovery or failed.
    The rule is as follows:
    Grade 7 or more: approved straight
    Between 5 and 7: is entitled to make a recovery test
    Below 5: Direct disapproved

    Commented code of the first program - what are Classes and Methods



    Now that you are a Java programmer - because you created a program already -
    we will understand what we did, what is that alphabet soup and what is every part of that bizarre coda

    This includes an explanation about car classes and methods.

    Java: Creating the first program in Java



    Now that you've installed the JDK and NetBeans
    it's time to create your first Java program!