Basic problem, please help.
I'm in a java class and my teacher's is horrible. Heavy accent, poorly explains things and goes very fast. Everything I've learned I've learned from the book and online. I've come into a jam here and our project is due Monday.
I have all the program written and it works just peachy, but I don't know how to create worker classes. I know I know, that's bad. I've looked every where. I have it all in the implementation class as of now. But, the only thing that can be in the impl class are input and output methods, no calculation methods. Please help me...
Here is the file: http://shofstetter.com/downloads/VendeingMachineImpl.java
Any suggestions or explainations would help a lot. I'm not asking for anyone to do my work, just some insight. I only need one worker class for all the calculations. I'll continue to work on my own, this is just a back up plan, thanks all.
Here's the source code if you don't want to download it...
//Steve Hofstetter. CIS 234 Assignment #1
public class VendingMachineImpl
public static void main(String args)
//get their name
name = JOptionPane.showInputDialog("What is your name?");
//get cost of time
inputString = JOptionPane.showInputDialog("How much does " + "your item cost? Example: 45 for 45 cents.");
//convert cost to an integer
cost = Integer.parseInt(inputString);
//control whether or not it is greater than 25 and a multiple of 5
(cost < 25 || ((cost % 5) != 0))
JOptionPane.showMessageDialog(null, "Your item needs to cost more than 25 cents and be a multiple of 5!!! Make a new selection.");
//if everything is okay, program continues
totalChange = 100 - cost;
//how many quarters
quarters = totalChange / 25;
//how many dimes
dimes = (totalChange % 25) /10;
//how many nickels
nickels = (totalChange % 25 % 10) / 5;
//print name, cost and change
JOptionPane.showMessageDialog(null, "Hello " + name + ". You bought an item for $0." + cost + " with a dollar. Your change is $0." + totalChange);
//print what change consists of
JOptionPane.showMessageDialog(null, "Your $0." + totalChange + " change consists of " + quarters + " quarters and " + dimes + " dimes and " + nickels + " nickels and 0 pennies.");