subject

Summary 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, and as such, you can complete this program with just a handful of lines (10–20) of code in just one main function. 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; you do not have to report the fractions in reduced form, though you may choose to do so (you do, however, have to count all equivalent fractions, e. g., 12/6 and 6/3 are equivalent to each other and each contribute to the number of occurrences of the reduced unique fraction 2/1).
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 for one of the actual inputs I’ll use when testing your submission; I may use other, similarly formatted input files. The code shoukd work for any number of lines (should work for 100,000 lines too)
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
Try to keep in mind basic "structured programming" principles such as modular design (ie, decompose complex tasks into individual methods), good variable & methods names (self-documenting code), and comments.
NB: By "unique fraction" I do not mean "unique string value" but "unique rational number value."
Consider reading one line at a time (with scanner. nextLine()), and using the split (Links to an external site.) function (defined in class String) to give you an array with two elements in it (the numerator and denominator, respectively).
Your program should work with input files besides the sample given, even long files (e. g., 100,000 lines long).

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 18:30
Write a program that prints the day number of the year, given the date in the form month-day-year. for example, if the input is 1-1-2006, the day number is 1; if the input is 12-25-2006, the day number is 359. the program should check for a leap year. a year is a leap year if it is divisible by 4, but not divisible by 100. for example, 1992 and 2008 are divisible by 4, but not by 100. a year that is divisible by 100 is a leap year if it is also divisible by 400. for example, 1600 and 2000 are divisible by 400. however, 1800 is not a leap year because 1800 is not divisible by 400.
Answers: 3
question
Computers and Technology, 24.06.2019 04:10
Write a program that reads a set of floating-point values. ask the user to enter the values, then print • the average of the values. • the smallest of the values. • the largest of the values. • the range, that is the difference between the smallest and largest. of course, you may only prompt for the values once.
Answers: 3
question
Computers and Technology, 24.06.2019 08:30
Why might you choose to create a functional resume
Answers: 1
question
Computers and Technology, 24.06.2019 13:00
Think of a spreadsheet as a giant calculator spread of paper chart data collector
Answers: 2
You know the right answer?
Summary In this assignment, you will build a program using techniques from previous CSS courses tha...
Questions
question
Mathematics, 30.12.2019 12:31
question
Social Studies, 30.12.2019 12:31
Questions on the website: 13722362