Site hosted by Angelfire.com: Build your free website today!

Frac Sub

If you wish to view the code only, check this page. You can click the links and it should open up in a notepad file.

 

class Fracsub{ //REMEMBER: Your program will not run if you do not use this exact class!
public static void main(String args[])
{
int FNum = 2;// changing these numbers chages the fractions.
int FDen = 3;
int SNum = 1;
int SDen = 4;

System.out.println("Here is some fraction crud for you.");

// Notice that words in quotes are printed out, variables are not in quotes.

System.out.println(FNum +"/"+ FDen + "minus " + SNum + "/" +SDen);
System.out.println("equals:");
System.out.println((FNum*SDen) - (SNum*FDen) +"/"+ (FDen*SDen));
}
}

 

 

No new terms for this program.