Question
JAVA Coding Assignment The assignment is to create a program using JAVA language that reads in a series of fractions from a txt file, which
JAVA Coding Assignment
The assignment is to create a program using JAVA language that reads in a series of fractions from a txt file, which will be formatted like: A/B, with A and B being numbers. A txt file is listed below. Your programs purpose is to read in each fraction and count the number of occurrences for the current fraction. When all the input is consumed, your program will print out its list of unique fraction and their corresponding count. (You may assume no blank lines or misleading characters. You may also assume the fractions in the input file are "normal" for a positive fraction, for example no division by zero, negative values, both numerator and denominator are integers, etc.)
*NOTE: You can complete this program with just a handful of lines (2030) of executable code in just one main method. You will need to use loops, ifs, comments, etc., (in other words, structured programming) to complete this assignment and achieve the outcomes listed below.
This is the input file used to test the program titled: fractions.txt
fractions.txt contains the following text:
6/3
4/2
5/9
80/90
800/900
15/25
5/5
1/1
1/10
1/100
1/1000
1/3
2/6
To explain how the program should work consider this txt file that contains the following:
6/3
7/3
6/3
12/6
The output to console is:
6/3 has a count of 3
7/3 has a count of 1
Finally, briefly answer the following questions:
- Can you complete this without using arrays? What is the least number of variables you can use to solve this problem?
- Can you use just one array to solve this? What would the data type be of that array?
- What does it mean to make a class so another class is inside (or part of) the first class, so that it is composed of other data types? What does "composition" mean in that case? How is it done?
WILL GIVE POSITIVE RATING. THANK YOU.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started