HTML Table introduction:

In this tutorial we will be expanding on our previous tutorial by creating multiple tables to store all of our future HTML tutorial data.

If you want to follow the tutorial please download tutorial template here
If you are following these tutorials continue to use your own source code from previous tutorial.

We will be using the following tags:
•Opening tag <table>
•Closing tag </table>
•Table row opening tag <tbody>
•Table row closing tag </tbody>
 •Table row opening tag <tr>
•Table row closing tag </tr>
•Table data opening tag <td>
•Table data closing tag </td>
•Table header opening tag <th>
•Table header closing tag </th>

HTML tables are made up of rows and columns.
• To create a row in a table <tr></tr> tags are used and to create columns the <td></td> tags are used.
• To create multiple rows and multiple columns the table data tags are enclosed within the table row tags      
<tr>
    <td></td>
</tr>
• Although its not recommended you can create a single row with multiple columns by using just the table data tag without the table row tags.
• To create a header at the top of each column you add the <th></th> tags and any text you input here will have a bold style and be centered in the header box.
• All of the tags above are enclosed within the table and table body tags


In this tutorial we will be creating five tables with multiple rows and columns. Each table will have a different variation in size.

For the Text Link section we are going to create a table with two rows and two columns. One column to store the header description text and the other to store the code used and the HTML element produced from the code.

The code below will create a table with a single row and column. Inside the table data tags type in HTML Code.

<h4>Text Link:</h4>
This is a preview of what is produced from the text link tutorial
<table ><tbody>
<tr> <td>HTML Code</td> </tr>
</tbody></table>

To add in the second column add in <td></td> after the table data closing tag </td> from the previous snippet of code above.

<h4>Text Link:</h4>
This is a preview of what is produced from the text link tutorial
<table ><tbody>
<tr> <td>HTML Code</td><td></td> </tr>
</tbody></table>

To add in the second row type in the following  from the snippet of code below and type in Link Produced in the left hand column of the new row.

<h4>Text Link:</h4>
This is a preview of what is produced from the text link tutorial
<table ><tbody>
<tr> <td>HTML Code</td><td></td> </tr>
<tr> <td>Link Produced</td><td></td> </tr>
</tbody></table>

If you save your document now and view it on a browser you will only see the text floating on the screen and no table outline. This is because HTML tables have no outline by default. To add an outline we have to add a border thickness.

Inside the table opening tag type in border="1" and  width="620". This will set the table size to 620px and it will also give the table a border.

<h4>Text Link:</h4>
This is a preview of what is produced from the text link tutorial
<table border="1" width="620"><tbody>
<tr> <td>HTML Code</td><td></td> </tr>
<tr> <td>Link Produced</td><td></td> </tr>
</tbody></table>

Repeat the last few steps for the Clickable Button, Onclick Event Button and URL Link Button sections of the tutorial template with the following alterations:

Clickable Button:               width="400"          Button produced instead of Link Produced
Onclick Event Button:        width="600"          Button produced instead of Link Produced
URL Link Button:              width="650"          Button produced instead of Link Produced


I have skipped the table for text link with target attribute section. To see if you have learned anything from this tutorial I would like you to create a table with five rows and two columns.
The table border = 2 and the width = 800. In the top left cell of the table type in HTML code and type Link Produced in the right hand cell.
Hint: The first row will store both text values unlike the other tables that we covered above which had one text value per row.

Save your HTML document and test on browser of choice. If you wish to continue following the tutorials type Yes into the table data column after HTML Table introduction in the completed tutorials table.

<tr>
   <td>HTML Table introduction</td>
   <td>Yes</td>
</tr>

To download the finished example for this tutorial please click here

In the next tutorial I will be talking about altering HTML tables.

Previous tutorial Next tutorial
HTML table alterations:

In this tutorial we will be expanding on our previous tutorial by creating multiple tables to store all of our future HTML tutorial data.

If you want to follow the tutorial please download tutorial template here
If you are following these tutorials continue to use your own source code from previous tutorial.


Change cell widths:
Inside the first table date tag type in width="110". This will set the column width to 110px and it will allocate the rest of the 620 table width to the other column in the table.
Repeat this step for the Clickable Button, Onclick Event Button and URL Link Button sections.
Note: A table with more than two columns will allocate the excess width to the rest of the columns in said table.

For the text link with target attribute table change the width to 600 for the first table data tag.

<h4>Text link:</h4>
This is a preview of what is produced from the Text link tutorial
<table width="620" border="1"><tr> <td width="110">HTML Code</td><td></td> </tr>
<tr> <td>Link Produced</td><td></td> </tr>
</tbody></table>

Change table headings text:
What we are going to do here is change the text that has been input into a cell. The text will change to bold text and be centered within the cell. Inside the first table date tag replace td with th and repeat this step for the next column as well.

<table width="800" border="2">
  <tr>
    <th width="600">HTML code</th>
    <th>Link Produced</th>
  </tr>

Change table border and background colours:
What we are going to do here is change the table border colour and alter the cell borders also. By default a table with a border thickness will have a black border outline. To alter the border colour you use the "bordercolor" attribute within the table opening tag. The border colour can be altered by putting in the text value of the colour ie "BLUE", or by using HEX values like "#0000FF". There are other input values for colour but we will be using the HEX value for this tutorial.

Inside the open table tag type in bordercolor="#0000FF" to change the border colour to blue. To change the background colour type in bgcolor="#CCCCCC" which looks like a teal colour.

<table width="800" border="2" bordercolor="#0000FF" bgcolor="#CCCCCC">
  <tr>
    <th width="600">HTML code</th>
    <th>Link Produced</th>
  </tr>
rest of the code goes here.....

</table>

Feel free to pick a choose colours for the border and background. For a cool colour picker which I found on the W3schools website click here

Save your HTML document and test on browser of choice. If you wish to continue following the tutorials type Yes into the table data column after Table Alterations in the completed tutorials table.

<tr>
   <td>Table Alterations</td>
   <td>Yes</td>
</tr>

To download the finished example for this tutorial please click here

In the next tutorial I will be talking about hyperlinks.

Previous tutorial Next tutorial

Text link to external website / page (hyperlink):
In this tutorial we will create a link to an external webpage with a href in the opening tag

If you want to follow the tutorial please download tutorial template here
If you are following these tutorials continue to use your own source code from previous tutorial.

We will be using the following tags:
•Opening tag <a>
•Closing tag </a>

The sample code below can be used as a template for creating an external website link on your website.

<a href="your url goes here">Link text goes here</a>

Inside the inverted commas you replace your url goes here with the website address of the site you want to link to. The best way of getting the exact link you require is to go to the website you want to link to and copy and paste the text in your browser address bar.

<a href="http://myprogramingjourney.blogspot.ie/">Link text goes here</a>

If you want at this stage you can save your HTML document and test your link in the browser of your choice.
The text within the opening and closing tags will be the text that will be shown on your browser and will be blue in colour and underlined as a default setting in your browser. Set this text to what ever you want the user to see.

<a href="http://myprogramingjourney.blogspot.ie/">My Programing Journey</a>

Save your HTML document and test on browser of choice. If you wish to continue following the tutorials type Yes into the table data column after Text hyperlink in the completed tutorials table.

<tr>
   <td>Text hyperlink</td>
   <td>Yes</td>
</tr>

To download the finished example for this tutorial please click here

In the next tutorial I will cover the target attribute

Previous tutorial Next tutorial
Text link with target attribute:
In this tutorial we will be setting the browser window / tabs destination with the target attribute

If you want to follow the tutorial please download tutorial template here
If you are following these tutorials continue to use your own source code from previous tutorial.

The code below is what we covered in the previous tutorial, it has no target attribute set. The target value will be set to the default setting which will open the link in the same window / tab that you or the user is currently in.
<a href="http://myprogramingjourney.blogspot.ie/">My Programing Journey</a>

Next we will be adding a target attribute within the opening tags to set the window / tab destination that you want to set.

Target attribute values are as follows:
target = "_blank"     New tab / window  
target = "_top"     Existing tab / window  
target = "_self"     Existing tab / window  
target = "_parent"     Existing tab / window  

In this example I have chose to use the _blank target. This will open the link in a new tab on a browser.
  • The advantage to using the new tab system is that your website page is still showing on the users browser.
  • The disadvantage to using the new tab system is that if the user closes your tab they will be left with the new tab from your hyperlink with no back history to your website.
<a href="http://myprogramingjourney.blogspot.ie/" target="_blank">My Programing Journey</a>

Save your HTML document and test on browser of choice. If you wish to continue following the tutorials type Yes into the table data column after Text hyperlink with target attribute in the completed tutorials table.

<tr>
   <td>Text hyperlink with target attribute</td>
   <td>Yes</td>
</tr>

To download the finished example for this tutorial please click here

In the next tutorial I will cover Anchor links in connection with table of contents

Previous tutorial Next tutorial
HTML Anchor link::
In this tutorial we will be extending the table of contents from the previous tutorial by adding a HTML anchor. A HTML anchor is used to link to relevant paragraphs / chapters within a webpage.

If you want to follow the tutorial please download tutorial template here
If you are following these tutorials continue to use your own source code from previous tutorial.

For an Anchor point we have to create a link to a paragraph on a page, then we ad an id tag to the linked paragraph. In this tutorial we will be creating a link to the Buttons section of the page. We will create a link similar to the hyperlink tutorial with a small variation to the link text inside the inverted commas.

To create the link type <a href="#Links"> before the Buttons section in the table of contents and add </a> to finish the link. Instead of a website address inside the inverted commas we will be adding a hash symbol # along with text that will be the id name for the anchor. I will explain the id tag in the next paragraph.

HTML code
Sample of code output
<a name="Top">Table of contents</a>
<ol>
   <li><a href="#Links">Links</a></li>
   <ul>
      rest of table of contents 
code goes here..........
</ol>

rest code goes here..........
Table of contents
  1. Links
    • Text Link
    • Text Link with target attribute
  2. Buttons
    • Clickable button
    • Onclick event button
    • URL link button
  3. Tutorials Completed


Now we will add the id tag to finish the connection for the anchor link. An id tag is the name of the link that you will be using as a bookmark inside the page. The best practice is to use the header title for the paragraph you want to link to.

The code for the id tag looks as follows <a name="Links"> </a>. The a href for a web address link is replaced with a name. The id tag in the code is "Links" . You can replace this text with what every you want to call the anchor id but it must match the link address set out above.

HTML code
Sample of code output
<a name="Top">Table of contents</a>
<ol>
   <li><a href="#Links">Links</a></li>
   <ul>
      rest of table of contents 
code goes here..........
</ol>
<h2><a name="Links">Links:</a></h2>

rest code goes here..........
Table of contents
  1. Links
    • Text Link
    • Text Link with target attribute
  2. Buttons
    • Clickable button
    • Onclick event button
    • URL link button
  3. Tutorials Completed

Links:


Save your HTML document and test on browser of choice.

Repeat the steps above for the rest of the table of contents and complete the additional anchor links below and save your HTML document and test on browser of choice.

Additional anchor links:
Note: The best use that I have seen for a link anchor on the web is to set a link to the top of the web page under each paragraph. This will allow the user to go to top of page without scrolling on computers, mobiles and tablets.
Sample code for top of page link: <a name="Top">Table of contents</a> to set anchor and <a href="#Top">Top of tutorial page</a> to create the link.
Output for code snippet above as follows Top of tutorial page

Save your HTML document and test on browser of choice. If you wish to continue following the tutorials type Yes into the table data column after Anchor Link in the completed tutorials table.

<tr>
   <td>Anchor Link</td>
   <td>Yes</td>
</tr>

To download the finished example for this tutorial please click here

Note:You can also create a link to an anchor point from another page with the following code.
<a href="http://myprogramingjourney.blogspot.ie/2014/07/test-anchor-link-page.html#testAnchor"> External anchor</a>
Output for code snippet above as follows Test external anchor

Replace the url which I have highlighted in yellow with your own url and the red highlighted text with your anchor text.


Previous tutorial Next tutorial
Clickable button:
In this tutorial we will create a clickable button. A button will be displayed on browser with assigned button text.

If you want to follow the tutorial please download tutorial template here
If you are following these tutorials continue to use your own source code from previous tutorial.

We will be using the following tags:
•Opening tag <button>
•Closing tag </button>

Firstly inside the opening tag we set the type to ‘button’ because different browsers have different default types. You should end up with the following code which will show a button in your browser with no text on it.
<button type="button"></button>

In between the opening and closing tags you can input text of your choice which will be displayed on the button. In this example I have put ‘Click here’.
<button type="button">Click here</button>

Save your HTML document and test on browser of choice. If you wish to continue following the tutorials type Yes into the table data column after Clickable Button in the completed tutorials table.

<tr>
   <td>Clickable Button</td>
   <td>Yes</td>
</tr>

To download the finished example for this tutorial please click here

The button will be clickable but it won’t do anything until we add an onclick event to the button which I will cover in the next tutorial.

Previous tutorial Next tutorial
Clickable button with onclick event:
In this tutorial we will create a clickable button with an onclick event. A button will be displayed on browser with assigned button text and when clicked an alert dialog box will be displayed.

If you want to follow the tutorial please download tutorial template here
If you are following these tutorials continue to use your own source code from previous tutorial.

An onclick event is added to the opening tag as shown below. I am going with an alert which will bring up an alert dialog that will display the text inside the brackets and an OK button.
<button type="button" onclick="alert('Button clicked')">Click here</button>

The alert method takes focus away from the current window and is used to get a message to a user. The user will have to click the OK button to continue back to original window.

Save your HTML document and test on browser of choice. If you wish to continue following the tutorials type Yes into the table data column after Clickable Button with an onclick event in the completed tutorials table.

<tr>
   <td>Clickable Button with an onclick event</td>
   <td>Yes</td>
</tr>

To download the finished example for this tutorial please click here

In the next tutorial I will show you how to create a link to a web page via a button.

Previous tutorial Next tutorial
Create a website link button:
In this tutorial we will create a clickable button with an onclick event that will link to a web site address.

If you want to follow the tutorial please download tutorial template here
If you are following these tutorials continue to use your own source code from previous tutorial.

Firstly we will add a value to the button. The value attribute specifies the initial value of the button and it will be used by some browsers.
<button type="button" value = "My Programing Journey"></button>

Next we will be using window.location with our onclick event when the button is clicked. A website URL will be assigned to the window.location.
In this tutorial I am using my home page address, you assign your own URL in place of mine.
<button type="button" value = "My Programing Journey" onClick = "window.location ='your URL goes here'"></button>

Finally add the text that you want displayed on the button in between the opening and closing button tags.
<button type="button" value = "My Programing Journey" onClick = "window.location ='http://myprogramingjourney.blogspot.ie/'">My Programing Journey</button>

Save your HTML document and test on browser of choice. If you wish to continue following the tutorials type Yes into the table data column after Create a website link button in the completed tutorials table.

<tr>
   <td>Create a website link button</td>
   <td>Yes</td>
</tr>

To download the finished example for this tutorial please click here

Previous tutorial
Assignment brief:
Create a software system that takes in the number of goals and points scored in a game of Hurling. A goal is treated as 3 points, each point being equal to a value of 1. The system should then calculate the total number of points scored, and display the result

Download source code here

// Start of code---------------------
import java.util.Scanner;

/* Usage notes:
 * Redistribution, alteration and use of this code with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * In no event shall the copyright owner be liable for any direct, indirect,
 * incidental, special, exemplary, or consequential damages arising in any
 * way out of the use of this software, even if advised of the possibility
 * of such damage.
 */

public class GAAcalc {
   
/*Brief description:
 *Read the goals and points
 *Each goal amounts to three points
 *Calculate the total points scored by adding goals*3 + points
 */

    public static void main(String[] args)
        Scanner keyboard = new Scanner(System.in);
       
        int goals, points, result;
       
        System.out.println("Enter goals scored: (Numeric digits only) ");
        goals = keyboard.nextInt();
       
        System.out.println("Enter points scored: (Numeric digits only) ");
        points = keyboard.nextInt();
       
        System.out.println("Total points scored: ");
        result = goals*3 + points;
       
        System.out.println(result);
   }
}
// End of code---------------------
Screenshot 



Assignment brief:
You have been asked to develop an application that generates a password based upon a user’s date of birth and the length of their first name.

The password is made up of the first name in lower case and a number which is calculated as follows:
  • Length of name + Unicode of uppercase version of the first letter + sum of 2 digits in day + sum of 2digits in month + last 2 digits of the year.
  • If Xavier was born on 12th March 1990 (12/03/1990) then the password is xavier190
  • where 190 comes from: (6 (length of name) + 88 (Unicode of 'X') + 1+2 (12 broken into its digits 1 and 2) + 0 + 3 (03 broken into 0+3) + 90(from year))

Download code here

// Start of code---------------------
 import java.util.Scanner;

 
/* Usage notes:
 * Redistribution, alteration and use of this code with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * In no event shall the copyright owner be liable for any direct, indirect,
 * incidental, special, exemplary, or consequential damages arising in any
 * way out of the use of this software, even if advised of the possibility
 * of such damage.
 */

public class PasswordGenerator {

/*Brief description:

 * Read the first name and date of birth from user
 * Unique password is calculated as follows:
 * •    lowercase first name  
 * •   + stringsize of first name 
 * •    + Unicode of capital initial from first name 
 * •    + Sum of numbers in day of birth 
 * •    + numbers in year of birth
 */
   


    public static void main(String[] args)
    {
        Scanner keyboard = new Scanner(System.in);
                      
        String firstname, dd, mm;
      
        int password, day, month, yy;
      
        System.out.println("Enter your First name" );
        firstname = keyboard.next();
      
        System.out.println("Enter dd of birth (Numeric digits only)");
        dd = keyboard.next();
      
        System.out.println("Enter mm of birth (Numeric digits only)");
        mm = keyboard.next();
      
        System.out.println("Enter yy of birth (Numeric digits only (ie: 80, 90))");
        yy = keyboard.nextInt();
      
        int stringSize = firstname.length();
      
        String lower = firstname.toLowerCase();
              
        char a = firstname.charAt(0);
      
        char upper = Character.toUpperCase(a);
      
        char ddletter1 = dd.charAt(0);
        char ddletter2 = dd.charAt(1);
      
        char mmletter1 = mm.charAt(0);
        char mmletter2 = mm.charAt(1);
      
        day = ddletter1 + ddletter2-96;
        month = mmletter1 + mmletter2-96;
      
        password = stringSize + upper + day + month + yy;
                  
        System.out.print("Your unique password is: " + lower + password);

    }

} // End of code---------------------
Assignment brief:
You are required to create an application so that students can remotely order their teas and coffees. If they make an invalid menu choice then they should be presented with a suitable error message and the application should give the options again.
Download full brief here

Download source code here

// Start of code---------------------
import java.util.Scanner;
import java.text.DecimalFormat;

/* Usage notes:
 * Redistribution, alteration and use of this code with or without
 * modification, are permitted provided that the following conditions are met:
 * In no event shall the copyright owner be liable for any direct, indirect,
 * incidental, special, exemplary, or consequential damages arising in any
 * way out of the use of this software, even if advised of the possibility
 * of such damage.
 */


public class TeaCoffeeMenu {
   
public static void main(String[] args) {
       
        Scanner input = new Scanner(System.in);
    System.out.print("\n__________________JAVA STOP___________________\n");
           
    DecimalFormat  df = new DecimalFormat ("\u20AC0.00");
   
    double cappuccinoCost = 2.00;
    double latteCost = 2.00;
    double espressoCost = 1.50;
    double americanoCost = 1.70;
    double bewleysCost = 1.80;
    double peppermintCost = 1.50;
    double camomileCost = 1.50;
    double deliveryCost = 1.00;
    double freeDeliveryCost = 0.00;
   
    String cost = null;
    String delivery = null;
    String deliverCost = null;
    String deliveryType = null;
    String totalCost = null;
    String menuType = null;
    String drinkType = null;
       
    int menu, Coffee, deliveryNumber;
   
             
        System.out.print("\n    *Coffee Menu enter 1 * Tea Menu enter 2*");
         
            menu=input.nextInt();
   
        while (menu< 1 || menu > 2) {
            System.out.println("Please select either '1' for Coffee or '2' for Tea");
                   
                menu = input.nextInt();                   
                }             
                switch (menu)
                    {
                    case 1:{ menuType = "Coffee";
                    System.out.print("\n\t\t Coffee Menu\n");
                    System.out.print("______________________________________________\n");
                    System.out.print("\n\t1.Cappuccino\t\t\u20AC2.00");
                    System.out.print("\n\t2.Latte\t\t        \u20AC2.00");
                    System.out.print("\n\t3.Espresso\t\t\u20AC1.50");
                    System.out.print("\n\t4.Americano\t\t\u20AC1.70");
                    System.out.print("\n______________________________________________\n");
       
        int coffeeNumber;
        System.out.print("\nPlease enter Your Choice 1,2,3,or4.");
        coffeeNumber=input.nextInt();
       
              if (coffeeNumber==1){
                  System.out.println("\n\tYou have ordered a Cappuccino !");
                  System.out.println("\t\u20AC2.00");
                  drinkType = "Cappuccino";
                  cost = (df.format(cappuccinoCost));}
              else if (coffeeNumber==2){
                  System.out.println("\n\tYou have ordered a latte !");
                  System.out.println("\t\u20AC2.00");
                  drinkType = "Latte\t";
                  cost = (df.format(latteCost));}
              else if (coffeeNumber==3){
                  System.out.println("\n\tYou have ordered an Espresso !");
                  System.out.println("\t\u20AC1.50");
                  drinkType = "Espresso";
                  cost = (df.format(espressoCost));}
              else if (coffeeNumber==4){
                  System.out.print("\n\tYou have ordered an Americano !");
                  System.out.println("\t\u20AC1.70");
                  drinkType = "Americano";
                  cost = (df.format(americanoCost));}
              else if (coffeeNumber< 1 || coffeeNumber > 4){
                  System.out.print("\nPlease enter Your Choice 1,2,3,or4.");}
                  break;
    }
        case 2: { menuType = "Tea";
            System.out.print("\n\t\tTea Menu\n");
            System.out.print("_______________________________________________\n");   
            System.out.print("   1.Beweley's Breakfast Tea (Pot for \u20AC1.80) \n");
            System.out.print("   2.Peppermint Tea\t\t\u20AC1.50\n");
            System.out.print("   3.Camomile Tea\t\t\u20AC1.50\n");
            System.out.print("_______________________________________________\n");
           
        int teaNumber;          
            System.out.println("\nEnter Your Choice 1,2,or3.");       
            teaNumber=input.nextInt();
       
              if (teaNumber==1){
                  System.out.print("\n\tYou have ordered Bewley's Breakfast Tea !");
                  drinkType = "Bewley's Breakfast \n\t\t\t  Tea (Pot)";
                  System.out.println("\t\u20AC1.80");
                  cost = (df.format(bewleysCost));}
              else if (teaNumber==2){
                  System.out.print("\n\tYou have ordered Peppermint Tea !");
                  System.out.println("\t\u20AC1.50");
                  drinkType = "Peppermint \n\t\t\t  Tea\t";
                  cost = (df.format(peppermintCost));}
              else if (teaNumber==3){
                  System.out.print("\n\t\tYou have ordered Camomile Tea ! ");
                  System.out.println("\t\u20AC1.50");
                  drinkType = "Camomile Tea";
                  cost = (df.format(camomileCost));}
              else if (teaNumber< 1 || teaNumber > 3){
                  System.out.print("\nPlease enter Your Choice 1,2,or3.");}
                   break;        
                    }   
                    default:
                    break;
                    }
        System.out.print("_______________________________________________\n");
               
        System.out.println("If You want it delivered (add £1.00) or \nFree for Collection from the Canteen");
                 
        System.out.println("\nPlease select either '1' for Delivery or \n\t\t     '2' for Collection");
               
            deliveryNumber = input.nextInt();
           
                if (deliveryNumber==1){
                        System.out.println("\nYou have selected delivery to Lab 1.2");
                        delivery = "Delivery";
                        deliveryType = "Delivery to Lab 1.2";
                        deliverCost = (df.format(deliveryCost));}
                else if (deliveryNumber==2){
                        System.out.println("\nYou have selected collection at Canteen");
                        delivery = "Collection";
                        deliveryType = "Collection at Canteen";
                        deliverCost = (df.format(freeDeliveryCost));}
                else if (deliveryNumber< 1 || deliveryNumber > 3){
                        System.out.println("Please select either '1' for Delivery or \n\t\t     '2' for Collection");}
             
        System.out.print("_______________________________________________\n");
   
    String fname, mname, lname, fullname, studentID, initials, orderNo, mobile;

        System.out.print("\nPlease enter your first name: " );       
        fname = input.next();
       
        System.out.print("\nPlease enter your middle name: " );       
        mname = input.next();
       
        System.out.print("\nPlease enter your last name: " );
        lname = input.next();
       
        fullname = fname + " " + mname + " "+ lname;
        String upper = fullname.toUpperCase();
   
            do{
                System.out.print("\nPlease enter your Studet ID Number (ie. R00123456): ");
                studentID = input.next();
            } while ( studentID.length() != 9 || 
              studentID.toUpperCase().charAt(0)!= 'R'  );
               
            do{
                System.out.print("\nPlease enter your Mobile Number (ie. 0871234567): ");
                mobile = input.next();
            } while ( mobile.length() != 10);
           
    char fnameletter = fname.charAt(0);
    char mnameletter = mname.charAt(0);
    char lnameletter = lname.charAt(0);
           
    //String initials = (fullname);
    //int spacePos = fullname.indexOf(" ");
    //System.out.println(initials.substring(0));
    //System.out.println(initials.substring(spacePos+1));

    initials = fnameletter+""+mnameletter+lnameletter;
   
    String newUpper = initials.toUpperCase();
   
    String ID = (studentID);
   
    String IDdigits;
       
    totalCost = cost + deliverCost;
   
    IDdigits = (ID.substring(5,9));
   
    orderNo = (newUpper +"_"+ID.substring(5,9));

    System.out.print("_______________________________________________\n\n");
    System.out.print("\t\t *** JAVA STOP ***\n");
    System.out.println("\n\tYOUR ORDER NUMBER IS: " + orderNo);
    System.out.println("\n\tNAME: " + upper);
    System.out.print("      _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n");
    System.out.println("\n\tITEM ORDERED:     "+drinkType +"\t"+ cost );
    System.out.println("\n\tADDITIONAL ITEMS: "+ delivery +"\t"+ deliverCost );
    System.out.println("\n\tTOTAL COST:                     "+ totalCost);
    System.out.print("      _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n");
    System.out.println("\n\tDELIVERY OPTION: "+deliveryType);
    System.out.println("\n\t    Thank you for your custom");
      }
      }// End of code---------------------