You are not logged in.
Someone asked the following via email:
For the Lab, what exactly did you want included with the report. I got a little confused reading the webpage about documenting the source code.
I have added comments to the code that we talked about earlier this quarter. I've included the code below and linked it from the schedule page. Hopefully this example along with the description here will help make it clear. If not please add follow-up questions here.
/*
* Course: SE-1010
* Section: 2
* Term: Fall 2006
* Author: Dr. Wu
* Assignment: Lab 0
* Date: 09/15/2006
*/
package lab0;
import javax.swing.*;
import java.text.*;
/**
* This class contains one method that prompts the user for the
* radius of a circle. It calculates the area and circumference
* for a circle with the entered radius and displays the answer
* to the console.
*
* @version 1.0 09/15/2006
* @author Dr. Wu
*/
public class Ch2Circle3 {
/**
* The main method that implements the functionality for the
* Ch2Circle3 class.
*
* @author Dr. Wu
* @param args Ignored
*/
public static void main(String[] args) {
final double PI = 3.14159;
// Identifier creation
String radiusStr;
double radius;
double area;
double circ;
java.text.DecimalFormat df
// Object creation
df = new java.text.DecimalFormat("0.000");
// Popup a window prompting the user to enter the radius
radiusStr = JOptionPane.showInputDialog(null, "Enter radius:");
// Converts the value of the radius from the String
// representation (raduisStr) to a double (radius).
radius = Double.parseDouble(radiusStr);
area = PI * radius * radius;
circ = 2.0 * PI * radius;
// Display results in the console window
System.out.println("");
System.out.println("Given radius: " + radius);
System.out.println("Area: " + df.format(area));
System.out.println("Circumference: " + df.format(circ));;
}
}Offline
What about the sample output? Did you want any particular format? Ex. "Your yearly income is: $7565.00", or did you want the inputs too with all of the messages associated with the inputs? Or did you simply want the output value: 7565.00? Or just the output line as in my example above?
-Daniel Stone
Last edited by Xodial (2006-09-21 15:08:37)
Offline