|
|
|
On this lab (and all future work in this course), the name of the files you submit and the name of the classes they contain must match. That is, the file Foo.java must contain (only) the class Foo.
-
Create a Java class named Circle (in a file Circle.java) that calculates the area of a circle for the user. Here are two examples of what the program should look like when you run it:
Enter the radius of the circle: 10
The area of the circle is 314.16.
Enter the radius of the circle: 39.43
The area of the circle is 4884.32374584.
Enter the radius of the circle: -10
Sorry, I can't do a negative radius.
Use the formula 3.1416r2 to calculate the area.
-
We want to write a program that counts for the user. It should ask them where to start, end, and what it should count by:
Start at: 3
End at: 10
Count by: 2
3 5 7 9
Start at: 100
End at: 120
Count by: 5
100 105 110 115 120
- Create a class Count1, and write this program using a for loop.
- Create a class Count2, and write this program using a while loop.
-
Create a class AlphaChars that contains these functions:
The class should contain no main function; you'll have to create another class to test it.
-
Create a text file named time.txt. In it, indicate how long it took you to complete this lab exercise.
When you're done, create a ZIP file containing all of the files you
created for this lab into a single file for submission. Submit your
work using the submission server.
|
|