Introduction to Java using NetBeans

Section 2.1 : Console Input

Learning Goals

We are Learning .......

- user input in the console
- message dialog boxes to display output

Success Criteria

What I'm Looking For......

- bug free java applications that efficiently solve the problems presented
- problem solving skills (try before you ask)
- efficient algorithm implementation
- formated and documented code
- organized website with code and executables

Curriculum Expectations

Programming Concepts and Skills
- demonstrate the ability to use different data types and expressions
- use proper code maintenance techniques when creating computer programs.

Software Development
- manage the software development process effectively


What is a Java Package?

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 Console 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.