Introduction to Java using NetBeans

Section 2 - Console Input


Java Packages

Java includes packages that contain general use classes, utility classes, or special purpose classes. 

The import statement is used to make the members of a package accessible to an application. 

In this assignment you will need the Scanner Package



Built in String Methods

next() - returns a string from the input stream

nextLine() - returns the string up to the end of line character from the input stream

nextInt() - returns the int read from the input stream

nextDouble() - returns the double read from the input stream

nextBoolean() - returns the Boolean read from the input stream

close() - closes the input stream




Ask the user 3 more questions and print out appropriate messages.

You should include double and boolean values in the answers.




Message Dialog Boxes

Changing The Message Box

In fact, there are variations for the showMessageDialog method that allow 2 more parameters so that you can change the title on the window as well as add a picture.  The format is:


Use this when you want to tell the user that an error has occurred in the program.

Use this when you want to warn the user about something in the program.

Use this when you want to tell the user something in the program.

Use this when you do not want a picture.




Assignments 2.1 - 2.4 - Modify Assignments 1.5 - 1.8 so that the user enters all required information
Display your results in a message box. (except bill of sale, leave it as console)

Above and Beyond is Required

Make sure you have uploaded them to the S1 Section of you website before you modify

ICS4U only

Assignment 2.5 Calculations

Create an application that displays the product and sum after the user enters 5 numbers. Display the result in a message box.

Above and Beyond is Required




Posting your work

1. Upload the Java Projects to your Gravelle Folder (Share with me only) and insert the Drive Folder (Insert > Drive Folder)

You do not need to submit code and screenshots as we will be combining these assignments later