this is just my coursework assignment which reads and writes a calculation to a file