Kuruptix
01-22-2012, 06:38 AM
This is my program that i am making
public class FreezeBoil
{
public static void printHeading()
{
System.out.println("Name");
System.out.println("CSC 201-01PR");
System.out.println("Freezeboil");
System.out.println("Project 1");
}
{
printHeading();
}
public static void main(String[] args)
{
final double FREEZE_PT = 32.0; // Freezing point of water
final double BOIL_PT = 212.0; // Boiling point of water
double avgTemp; // Holds the result of averaging
// FREEZE_PT and BOIL_PT
// Display initial data
System.out.print("Water freezes at " + FREEZE_PT);
System.out.println(" and boils at " + BOIL_PT + " degrees.");
// Calculate and display average
avgTemp = FREEZE_PT + BOIL_PT;
avgTemp = avgTemp / 2.0;
System.out.println("Halfway between is " + avgTemp + " degrees.");
}
}
When i run this in the compiler, the only thing that shows up is the "Water Freeze at" "and boils at degrees" text.
// Display initial data
System.out.print("Water freezes at " + FREEZE_PT);
System.out.println(" and boils at " + BOIL_PT + " degrees.");
// Calculate and display average
avgTemp = FREEZE_PT + BOIL_PT;
avgTemp = avgTemp / 2.0;
System.out.println("Halfway between is " + avgTemp + " degrees.");
I want it to also display the header as well which is
public static void printHeading()
{
System.out.println("Name");
System.out.println("CSC 201-01PR");
System.out.println("Freezeboil");
System.out.println("Project 1");
How do i make both of them show up?
thanks
public class FreezeBoil
{
public static void printHeading()
{
System.out.println("Name");
System.out.println("CSC 201-01PR");
System.out.println("Freezeboil");
System.out.println("Project 1");
}
{
printHeading();
}
public static void main(String[] args)
{
final double FREEZE_PT = 32.0; // Freezing point of water
final double BOIL_PT = 212.0; // Boiling point of water
double avgTemp; // Holds the result of averaging
// FREEZE_PT and BOIL_PT
// Display initial data
System.out.print("Water freezes at " + FREEZE_PT);
System.out.println(" and boils at " + BOIL_PT + " degrees.");
// Calculate and display average
avgTemp = FREEZE_PT + BOIL_PT;
avgTemp = avgTemp / 2.0;
System.out.println("Halfway between is " + avgTemp + " degrees.");
}
}
When i run this in the compiler, the only thing that shows up is the "Water Freeze at" "and boils at degrees" text.
// Display initial data
System.out.print("Water freezes at " + FREEZE_PT);
System.out.println(" and boils at " + BOIL_PT + " degrees.");
// Calculate and display average
avgTemp = FREEZE_PT + BOIL_PT;
avgTemp = avgTemp / 2.0;
System.out.println("Halfway between is " + avgTemp + " degrees.");
I want it to also display the header as well which is
public static void printHeading()
{
System.out.println("Name");
System.out.println("CSC 201-01PR");
System.out.println("Freezeboil");
System.out.println("Project 1");
How do i make both of them show up?
thanks