Example of How To Create A Java Coffee Shop Program

Photo by Social Mode on Unsplash



How to create a Java Coffee Shop Program

This is a Java tutorial for creating a coffee shop program, the code below is how to set up the various java checkboxes and java radio buttons. In this tutorial, I utilized the Netbeans IDE which is great for developing Java GUIs in order to create something for the user to interact with. 

The Java GUI code is automated and all that is necessary is to add the logic for the buttons, ensuring that your java logic is how it is supposed to be will ensure of a successful program and is what the user is expecting. By using the simple java logic below I was able to create multiple programs including my java vending machine program as well as the coffee shop program. Both videos are down below for your viewing pleasure.




Remember in Java to comment there are several ways one is to place two forward slashes as seen below. 

//How to create a Coffee Shop Java Program



//Below we are creating a decimal format that will print out any remainder change with two decimal places. 



       DecimalFormat df = new DecimalFormat("0.00");



//Below are the variables we will be using


        double total;

        double subtotal = 0;

        final double TAXRATE = .08;

        double tax;

      

 //our radio buttons are next


        if (radCoffee.isSelected()){

            subtotal = subtotal + 1;

        }else if (radCap.isSelected()){

            subtotal = subtotal + 1.25;

        }else if (radTea.isSelected()){

            subtotal = subtotal + 1;

        }


        //these are our checkbox buttons


        if (chkBag.isSelected()){

           subtotal = subtotal + 1.25;

        }if (chkCro.isSelected()){

           subtotal = subtotal + 1.15;



The rest of this code and how to create these GUI's can be done with the videos below.








No comments:

Post a Comment

Flag Quiz Game

Enjoy this free android app in the google play store. If you want to learn about the many country fl...