Question: Question 1: (20 marks) a) Write a method that reads candidates information from an input file, an example of which follows: 2 Trump:35:8 Biden:18:26 The

Question 1: (20 marks) a) Write a method that reads candidates information from an input file, an example of which follows: 2 Trump:35:8 Biden:18:26 The first line consists of a number that specifies how many candidates are running for the US presidential election. If that number is n, the next n lines each specify a candidate, with the candidate's name appearing on the line first, followed by a colon, and followed by the number of popular and electoral votes received by that candidate each separated by a colon. Then the method finds and returns the winner information who got the maximum electoral votes. You may assume that the input file will always be properly formatted according to this specification. (10 marks) b) Design and implement a JavaFX GUI which has a text area and a button. When the program starts up, it calls your method in (a) to read and return the winners information in an appropriate format, so once the user clicks the button, it displays the winner who got the maximum electoral votes. (10 marks)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!