Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use input file which you will create in notepad. Each line of input file inData.txt has name, capital, and population in this order. The data

image text in transcribed

Use input file which you will create in notepad. Each line of input file "inData.txt has name, capital, and population in this order. The data for the first eight countries in the input file should be as given. Ado additional four rows of countries of your choice. USA washington, D.C. 32617 France Paris 65.23 Slovenia Ljubljana 2.08 Slovakia Bratislava 5.44 Liechtenstein Vaduz 0.05 Monaco 0.04 Spain Madrid 46.42 Use Bluel to write a program with classes Country, CountryCollection and TestCountryCollection that reads Country objects from an input file. Tokio 126.53 Class Country describes one country object and has variables: m and capital of String type, and population of long type. In addition, class Country has methods: Do not forget to append thro OExsantien to the main method header in the class In addition, you have to provide the following import statements in order to public String gatNanaO public String gatCapital returns capital public boalean islarasSO public double gstPerulatisn I/ returns number of inhabitants (in millions). public String tostringO // returns name // returns true for above 50 million inhabitants else returns false // returns string with all country's data in one line input data from input file and use Scanner class: import java ioi import java.util // separated by tabs. SUBMIT a single word or PDF document named p2 yourLastName CS152 with the following: . Your name, class section and project number and date of submission in the upper left corner Class CountryCollection has no instance variables and provides the following recursive methods. Each method accepts parameter list, which is array of countries, and parameter n, which is an actual number of countries in the list. Copy of the code for each class in separate rectangle .Copy of your input file .Picture of program run from Bluel. .UML diagram. public static String tostring (CountEx list, int n) //returns String of all countries // in the list, one country per row. Countries must be in same order as they appear in the original list. public static int ssuntlaxaeSountxies (Countr list, int n) //returns number of public static Country smallestCountEy (CountryI list, int n) //returns country public static void printLargeCountries (CountryL) list, int n) /prints all large // large countries in the list // with smallest population // countries in the list. Countries must be printed in same order as they appear in the original list. EXTRA CREDIT (1 point) public static ArrayList largeCountries (Countryw list, int n} //returns the Acraylist of all large countries in the list (in terms of their population). Must use islargel) method. Class TestCountryCellestien will only have main method in it. In the main method read countries from the input file and store them in Country) nyliat Count countries as you read from the input file. Store count..n variable myCount of int type. Invoke each o te four static methods from class, plus extra credit, if done

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro Database Migration To Azure Data Modernization For The Enterprise

Authors: Kevin Kline, Denis McDowell, Dustin Dorsey, Matt Gordon

1st Edition

1484282299, 978-1484282298

More Books

Students also viewed these Databases questions