Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please code the following assignment in java without using hashmap but arrays. Thank you! Your project is to read in a series of fractions from
Please code the following assignment in java without using hashmap but arrays. Thank you!
Your project is to read in a series of fractions from a text file, which will have each line formatted as follows: AB A sample text file is listed below, and the purpose of your program is to read in each fraction and count the number of occurrences for the current fraction. When all the input is consumed or as the input is consumed your program will print out its list of unique fraction and their corresponding count see the output below and you may assume no blank lines or misleading characters; see the text file link on the website for one of the actual inputs Ill use when testing your submission
Sample Input File named fractions.txt:
Sample Console Output
has a count of
has a count of
NOTE: it is also fine though not required if your program simplifies the fractions so that the output is:
has a count of
has a count of
But either way, and count as the same fraction, so you do need some mechanism for determining if two fractions that look different are actually the same. The only optional part of the assignment is how you display them in the end.
Notes & Hints
Be sure to put code that gets lengthy into its own method!
This assignment is particularly guiding in the outcomes section; expect future assignments to test your ability to build your own programming contract for the problem at hand.
Test your code as you add features either methods or variables incrementally, making sure your small change works as you envisioned it to
Try to keep in mind basic structured programming principles such as modular design ie decompose complex tasks into individual methods good variable & methods names selfdocumenting code and comments.
Consider reading one line at a time with scanner.nextLine and using the splitLinks to an external site. function defined in class String to give you an array with two elements in it the numerator and denominator, respectively
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