Other Miscellaneous Java Examples


Employee Payroll Program

if statement / if-else statement
Import Statement / this. reference variable
toString() method

This is a program that accepts a employees name, employee number, hire date, day or night shift, pay rate, monthly bonus, required training hours, and attended training hours and then displays them using the ToString() method.

Here's the code!


Download Class 1 (Demo)
Download Class 2

Student Essay Grade Program

if-else-if statement / protected access modifier
Extends parent class / Constructor
Extends parent class

This program lets you enter a score 1-20 for each section of the grading rubric. The sections consist of grammar, spelling, correct length, and content.

Here's the code!


Download Class 1 (Demo)
Download Class 2
Download Class 3

Valid/Invalid Account Number Program

Array / Sequential Search
While loop

This is a program that allows you to enter an account number. The program then uses a sequential search to look for that account number in an array. If it's found it display "Account number is valid", if it's not found it display "Account number is invalid".

Here's the code!


Download Class 1 (Demo)
Download Class 2

Area Calculator Demo

Overloaded Constructor / Static Members

This is a program that uses overloaded constructors to create an area calculator. It lets you enter a length, width, height, and radius. Then passes that information through 3 identical contructors that pass different arguements to calculate the area for a circle, rectangle, and cylinder.

Here's the code!


Download Class 1 (Demo)
Download Class 2

Room Carpet Area Calculator

Aggregation

This program allows you to enter a length, width, and price per square foot for carpet that needs to be installed in a room. It then uses aggregation to calculate the area and the total cost.

Here's the code!


Download Class 1 (Demo)
Download Class 2
Download Class 3

Roman Numerals

Switch statement

This is a very simple program that lets you enter a number 1-10. It then uses a switch statement to print the roman numeral for that number.

Here's the code!


Download Class 1 (Demo)

Average test scores calculator

Thowing exceptions / For loop

This is a simple Java program that demonstrates thowing an exception. If any test score you enter is less than 0 or greater than 100 it will throw a IllegalArguementException().

Here's the code!


Download Class 1 (Demo)
Download Class 2

Greatest and Least

Do-While loop / Sentinal Value

This program allows you to enter as many numbers as you want untill you enter a sentinal value of -99. Once you enter -99 it calculates the greatest number and the least number you entered. It then displays those numbers.

Here's the code!


Download Class 1 (Demo)

Polymorphic Interface Demo

Polymorphism / Inferface
Intance Fields / Instance Methods

This four class Java program demonstrates polymorphism and interfaces.

Here's the code!


Download Class 1 (Demo)
Download Class 2
Download Class 3
Download Class 4

Speed of Sound Demo

Comparing Strings

This program asks you to enter "Air, water, or steel". It then asks you to enter the distance the sound will travel. After this it does the math and compares the strings you enetered to tell you how long it will take the sound to travel in air, water, or steel.

Here's the code!


Download Class 1 (Demo)
Download Class 2

Land Tract Calculator

Equals() method

This program asks you to enter the length and width for 2 tracts of lands and then tells you whether their areas are equal to eachother or not equal to eachother.

Here's the code!


Download Class 1 (Demo)
Download Class 2