UML Diagram of City Class: City - cityID: int - cityName: String - country:String - population: int +City() +City(cityID: int, cityName: String, country:String, country: String, population: int) +setCityID(cityID:int): void +getCityID():int +setCityName(cityName:String): void +getCityName():String +setCountry(country:String): void +getCountry():String +setPopulation (population:int): void +getPopulation():int +getCityCategory(): String +toString:String SUBMISSION: Submit the zipped folder with the following files: → City.java → xxxx_program.java → CityReport.csv CPS 2231 - Computer Programming – Spring 2025 City Report Application - Due Date: Concepts: Classes and Objects, Reading from a file and generating report Point value: 40 points. The purpose of this project is to give students exposure to object-oriented design and programming using classes in a realistic application that involves arrays of objects and generating reports. Assignment Instructions: You are tasked with developing a program to use city data from an online database and generate a city details report. 1) Create a new Project in Eclipse called "HW7”. 2) Create a class "City.java" in the project and implement the UML diagram shown below and add comments to your program. 3) The logic for the method "getCityCategory" of City Class is below: a. If the population of a city is greater than 10000000, then the method returns "MEGA" b. If the population of a city is greater than 1000000 and less than 10000000, then the method returns "LARGE" c. If the population of a city is greater than 100000 and less than 1000000, then the method returns "MEDIUM" d. If the population of a city is below 100000, then the method returns ❝SMALL" 4) You should create another new Java program inside the project. Name the program as "xxxx_program.java”, where xxxx is your Kean username. 3) Implement the following methods inside the xxxx_program program The main method calls another method “readfromFile" which reads each line from the given csv file "worldcities.csv" - The readfromFile method will store the data in an array of objects for City class. - - Create a generate Report method that generates the "City Report.csv" file. The headings are added as shown below in sample output. Include comments in your program Sample screenshot of the output "CityReport.csv" file 1 CityID 23456789 City Name 1566979497 Abeokuta 1682452296 Ad DammÄm Country Nigeria Population City Category 888924 MEDIUM Saudi Arabia 903312 MEDIUM 1356304381 Ahmedabad India 7717000 LARGE 1566568277 Akure 1608824345 Antipolo Nigeria 847903 MEDIUM Philippines 887399 MEDIUM 1368838855 Ar RamÄdÄ<< Iraq 874543 MEDIUM 1356410365 Bangalore India 13999000 MEGA 1764068610 Bangkok Thailand 17573000 MEGA
UML Diagram of City Class: City - cityID: int - cityName: String - country:String - population: int +City() +City(cityID: int, cityName: String, country:String, country: String, population: int) +setCityID(cityID:int): void +getCityID():int +setCityName(cityName:String): void +getCityName():String +setCountry(country:String): void +getCountry():String +setPopulation (population:int): void +getPopulation():int +getCityCategory(): String +toString:String SUBMISSION: Submit the zipped folder with the following files: → City.java → xxxx_program.java → CityReport.csv CPS 2231 - Computer Programming – Spring 2025 City Report Application - Due Date: Concepts: Classes and Objects, Reading from a file and generating report Point value: 40 points. The purpose of this project is to give students exposure to object-oriented design and programming using classes in a realistic application that involves arrays of objects and generating reports. Assignment Instructions: You are tasked with developing a program to use city data from an online database and generate a city details report. 1) Create a new Project in Eclipse called "HW7”. 2) Create a class "City.java" in the project and implement the UML diagram shown below and add comments to your program. 3) The logic for the method "getCityCategory" of City Class is below: a. If the population of a city is greater than 10000000, then the method returns "MEGA" b. If the population of a city is greater than 1000000 and less than 10000000, then the method returns "LARGE" c. If the population of a city is greater than 100000 and less than 1000000, then the method returns "MEDIUM" d. If the population of a city is below 100000, then the method returns ❝SMALL" 4) You should create another new Java program inside the project. Name the program as "xxxx_program.java”, where xxxx is your Kean username. 3) Implement the following methods inside the xxxx_program program The main method calls another method “readfromFile" which reads each line from the given csv file "worldcities.csv" - The readfromFile method will store the data in an array of objects for City class. - - Create a generate Report method that generates the "City Report.csv" file. The headings are added as shown below in sample output. Include comments in your program Sample screenshot of the output "CityReport.csv" file 1 CityID 23456789 City Name 1566979497 Abeokuta 1682452296 Ad DammÄm Country Nigeria Population City Category 888924 MEDIUM Saudi Arabia 903312 MEDIUM 1356304381 Ahmedabad India 7717000 LARGE 1566568277 Akure 1608824345 Antipolo Nigeria 847903 MEDIUM Philippines 887399 MEDIUM 1368838855 Ar RamÄdÄ<< Iraq 874543 MEDIUM 1356410365 Bangalore India 13999000 MEGA 1764068610 Bangkok Thailand 17573000 MEGA
Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter11: More Object-oriented Programming Concepts
Section: Chapter Questions
Problem 6PE
Related questions
Question

Transcribed Image Text:UML Diagram of City Class:
City
- cityID: int
- cityName: String
- country:String
- population: int
+City()
+City(cityID: int, cityName: String, country:String, country: String,
population: int)
+setCityID(cityID:int): void
+getCityID():int
+setCityName(cityName:String): void
+getCityName():String
+setCountry(country:String): void
+getCountry():String
+setPopulation (population:int): void
+getPopulation():int
+getCityCategory(): String
+toString:String
SUBMISSION: Submit the zipped folder with the following files:
→ City.java
→ xxxx_program.java
→ CityReport.csv

Transcribed Image Text:CPS 2231 - Computer Programming – Spring 2025
City Report Application
-
Due Date:
Concepts: Classes and Objects, Reading from a file and generating report
Point value: 40 points.
The purpose of this project is to give students exposure to object-oriented design and programming
using classes in a realistic application that involves arrays of objects and generating reports.
Assignment Instructions:
You are tasked with developing a program to use city data from an online database and generate a
city details report.
1) Create a new Project in Eclipse called "HW7”.
2) Create a class "City.java" in the project and implement the UML diagram shown below and add
comments to your program.
3) The logic for the method "getCityCategory" of City Class is below:
a. If the population of a city is greater than 10000000, then the method returns "MEGA"
b. If the population of a city is greater than 1000000 and less than 10000000, then the
method returns "LARGE"
c. If the population of a city is greater than 100000 and less than 1000000, then the method
returns "MEDIUM"
d. If the population of a city is below 100000, then the method returns ❝SMALL"
4) You should create another new Java program inside the project. Name the program as
"xxxx_program.java”, where xxxx is your Kean username.
3) Implement the following methods inside the xxxx_program program
The main method calls another method “readfromFile" which reads each line from the given
csv file "worldcities.csv"
-
The readfromFile method will store the data in an array of objects for City class.
-
-
Create a generate Report method that generates the "City Report.csv" file.
The headings are added as shown below in sample output. Include comments in your program
Sample screenshot of the output "CityReport.csv" file
1 CityID
23456789
City Name
1566979497 Abeokuta
1682452296 Ad DammÄm
Country
Nigeria
Population
City Category
888924 MEDIUM
Saudi Arabia
903312 MEDIUM
1356304381 Ahmedabad
India
7717000 LARGE
1566568277 Akure
1608824345 Antipolo
Nigeria
847903 MEDIUM
Philippines
887399 MEDIUM
1368838855 Ar RamÄdÄ<<
Iraq
874543 MEDIUM
1356410365 Bangalore
India
13999000 MEGA
1764068610 Bangkok
Thailand
17573000 MEGA
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps

Recommended textbooks for you
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage

Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage

Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning

EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT

Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning