Question
The CasesByCountry class has three instance variables, a three-parameter constructor, three get methods and one set method for the number of cases.The instance variables will
TheCasesByCountryclass has three instance variables, a three-parameter constructor, three get methods and one set method for the number of cases.The instance variables will hold the country, number of cases, and the population of the country.This class will be used in theCasesByCountryTestprogram.Do NOT modify the code in theCasesByCountryclass. I attached the CasesByCountry file screenshot below
I have to make a program named CasesByCountryTest
The test program will test theCasesByCountryclass by creatingCasesByCountryobjects that will be stored in an array.The program must do the following:
- make an array namedcasesof typeCasesByCountrythat will hold 20CasesByCountryobjects.
- EachCasesByCountryobject will be created with literal data for the 20 countries with the most confirmed cases of COVID-19. I mustget the data from this site on the day that you do the assignment:
https://coronavirus.jhu.edu/map.html(Links to an external site.)
Note that the population is taken from the United Nations 2019 data.
https://en.wikipedia.org/wiki/List_of_countries_by_population_(United_Nations)(Links to an external site.)
- I must use theCasesByCountryconstructor to create each object using literal data as arguments. Store each object in thecases
- Use a for loop to print a table of theCasesByCountrydata in the array. Be sure to print the table headers before the loop.Print the country, the number of cases, the population and the percentage of cases on each row.You must calculate the percentage of cases based on the number of cases and population.You can get help with percentages here:
https://www.khanacademy.org/math/pre-algebra/pre-algebra-ratios-rates/pre-algebra-percent-problems/v/finding-percentages-example(Links to an external site.)
- All data in each row must be right aligned.Print the number of cases and the population with a comma.For example: "%,7d" will print 23,136.Print the percentage with 4 places past the decimal point.
- make a for loop to go through the array to find the country with the highest percentage of cases. Print the country and the highest percentage, formatted and clearly labeled.note that my result will be different from the sample program run.
- Use Sublime Text 3 or a simple editor for the program. Your name must appear in the output or one point will be deducted.all oyput must be carefully labeled
- I'm also attaching the how output should look like and the sample output data is from April 3 so our output result will be different
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