Directions: The midterm consists of two programs that you need to code. You can do this in either Netbeans or just Notepad. The programs will test your Java and general programming skills. Some point to remember:
Write a program in which you do all of the following:
int, short, float, ...
) and assign some values in each one. Then print these variables’ values using System.out.println()
.String
variable—call it myString
—and store a 15-character string in it (for e.g.,"The Golden Rule"
). Then print out:myString
in any order, and display the new string; otherwise display a lowercase version of the new string.Write a program that asks the user for the radius of a circle. Store this as a double value in a double
variable. Then calculate and print out the area and circumference of the circle. Make sure your output looks like this:
For a circle with radius 12.52, the area is 492.196, and circumference is 78.6256
Note: Area of a circle is π*r*r; circumference is 2*π*r.