Copyright  © – Sudharsan Iyengar

 

CS – 234                                 Lab 9                           11/6/24

 

Objects, Files, Arrays, and Loops

 

Write an application that uses a scanner and reads from a file fractions.dat

 

a)               The first line of the file has an integer – representing the number of lines of data to follow.

b)               Each line after that contains – information to be stored in a fraction object viz. Fraction name (String), numerator (int) and denominator (int).

c)               Create an array of objects – using the fraction class.

 

Your application should allow users to do the following any number of times:

 

1.               Output a menu for the user to select from operations – display, addition, subtraction, multiplication, division, and exit

2.               Receive the selection of operations from the user.

3.               Output a menu for the user to select from the list of fractions.

4.               Receive the selection(s) of fractions from the user

5.               Perform the chosen operation and output the result of the operation.

6.               Perform this until the user selects the exit option.