![]() |
CS 107 - Introduction to Scientific Computation Homework #12 |
0. Preparatory Reading: You will benefit from reviewing the portions of Java we've covered in the CS 111 Java Summary.
1. Greetings: Create a Java program Greetings.java that prompts
the user to input their name, and prints "Hello, <name>!".
2. Circle Math: Create a Java program CircleMath.java that prompts the user to input a double radius, and prints the double diameter, circumference, and area.
Note: You can calculate the square of radius by using either
radius * radius or Math.pow(radius, 2).
Example Transcript (input underlined):
Radius? 10
diameter = 20.000000
circumference = 62.831853
area = 314.159265
3. Division: Create a program Division.java that has the user enter two integers, which are then used to compute both the floating point and integer division results as follows (user input underlined):
Please enter integer a: 9 Please enter integer b: 4 Floating point division: a/b = 2.250000 Integer division: a/b = 2 remainder 1
4. Circle: Define a class Circle (in Circle.java) with