|
|
Java Student Project |
||
|
|||
Exponent |
|||
|
|
|
||
| Ability Level: | Beginner | ||
|
|
|
||
| Estimated Time: | 40 minutes | ||
|
|
|
||
| Objectives: |
|
||
|
|
|
||
| Materials & Resources: |
|
||
|
|
|
||
| Overview: | This assignment
will create a program to calculate the square of a number
and the cube of a number.
This program must be
user friendly, outputting the name of the program, the
program author, and date written. Read the hints in this
project for further understanding. |
||
|
|
|
||
| Instructions: |
|
||
|
|
|
||
| Hints: | Some important
points to keep in mind in doing this project:
The file name and the project name need to be the same. Writing a Java program A. All Java statements must end with a semi-colon (;) B. Programs may contain literal strings (a series of characters in double quotes) C. Programs contain user-defined variables and methods D. The statement System.out.println( "Hello") is an example of a call to a method of the out object which is contained in the static class System. This method accepts a string as an argument, in this case, "Hello" which is a string literal. The argument is passed to the method which displays it on the monitor E. All programming statements in Java must be part of a class. A class name must conform to specific syntax rules.
F. Java programs may have comments which provide explanations of the program and its details to help programmers understand the code, and to make program modification and maintenance simpler.
G. Rounding can be done
with a method. The value, temp, is calculated. Next
Math.round(temp) is used to round the value. Then temp is
divided by the integer of Math.pow(10,places) and last
returned through the variable temp. public static float
round(double f, int places) |
||
| Extras: | In case you need to look at the J++ compiler steps: Starting Java | ||