Question
Only use arrays to hold your data. Do not use Java's ArrayList. TO CHECK IF TWO FACTION EQUAL USE CROSS-MULTIPLYING. In this assignment, you will
Only use arrays to hold your data. Do not use Java's ArrayList. TO CHECK IF TWO FACTION EQUAL USE CROSS-MULTIPLYING.
In this assignment, you will build a program using techniques from previous CSS courses that counts unique fractions. No new constructs from our readings are expected.You will need to use loops, ifs, comments, etc., (in other words, structured programming) to complete this assignment and achieve the outcomes listed below. Included below is a sample execution of your program as well as a list of outcomes your program is to implement; notice reduction of fractions is optional in this version of the assignment.
Introduction
Your project is to read in a series of fractions from a text file, which will have each line formatted as follows: A/B. 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).
The fractions should always be represented as two integers - DO NOT USE DECIMALS.
Only use arrays to hold your data. Do not use Java's ArrayList. We will discuss in class how to grow your array.
You do not need to reduce fractions for this assignment. We will discuss in class how to compare values.
Sample Input File
fractions.txt
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 1/2 1/3 1/1 1/4 1/5 1/6 1/7 1/8 1/9 2/1 2/2 2/3 2/4 2/5 2/6 2/7 2/8 2/9
Sample Text Input
6/3
7/3
6/3
12/6
Sample Console Output
6/3 has a count of 3
7/3 has a count of 1
Questions
Notes
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