Er... hi?
Well. I'm a complete n00b to programming, so please don't, uh, point and laugh at my inept coding. Or do, I don't care, just tell me what I'm doing wrong. I've only been in class for three weeks, so, um, I'm not very good. Anyway, my problem with this program is that I keep receiving an error for part of my code. It isn't accepting "private" as a valid start of the program. I'm guessing that I'm messing up something pretty simple, like a bracket in the wrong place or something not capitalized, but I can't see it. Any help would be very much appreciated.
Thank you very much in advance!
/* Homework #1
* This program is in two parts -
* 1. The program converts degrees Fahrenheit to degrees Centigrade.
* 2. The program takes an amount of money and finds the smallest
* number of cents that it can be divided into.
*/
import java.io.*;
public class HwOneApp
{
// class data
static private PrintWriter screen = new PrintWriter(System.out,
true);
static private BufferedReader keyboard = new BufferedReader(
new
InputStreamReader(System.in));
static private PrintWriter ps;
static private int cents, quarters, dimes, nickels, pennies, totCoins;
// class methods
public static void main(String [] argv) throws IOException
// Part One
{
double degF, degC;
ps = new PrintWriter (new FileWriter ("HwOneOut.doc"));
for (int i = 1; i <= 5; i++)
{
screen.print("\nEnter a temperature in degrees F > ");
screen.flush();
degF = Double.parseDouble(keyboard.readLine());
ps.println ("\nEnter a temperature in degrees F > " + degF);
degC = (5.0 / 9) * (degF - 32);
screen.println( + degF + " degrees F = " + degC + " degrees C");
ps.println ( + degF + " degrees F = " + degC + " degrees C");
}
{
// Part Two
for (int i = 1; i <= 5; i++);
{ cents = quarters = dimes = pennies = nickels = totCoins = 0;
cents = getCents();
calCoins();
displayResults(screen);
displayResults(ps);
} ps.close();
// method #2
//This method prompts user for input amount.
private static int getCents() throws IOException
{ int money = 0;
screen.print("\nEnter an amount of money >");
screen.flush();
mone = Integer.parseInt (keyboard.readline());
ps.prinntln ("\nEnter an amount of money >" + money);
return money;
}
// method #3
//This method calculates the minimum output amount.
private void calCoins
{ int temp = 0;
quarters = cents / 25;
temp = cents % 25
dimes = temp / 10
temp = temp % 10
nickles = temp / 5
temp = temp % 5
pennies = temp / 1;
totCoins = quarters + dimes + nickles + pennies;
}
// method #4
// This method displays the minimum number of coins by denomination.
private static void displayResults (PrintWriter fps);
{
fps.println ("\n Part Two Results" +
"\n Total Coins = " + totCoins +
"\n Quarters = " + quarters +
"\n Dimes = " + dimes +
"\n Nickels = " + nickels +
"\n Pennies = " + pennies);
}}}}
Thank you very much in advance!
