Question

In: Computer Science

Hi, I am getting illegal start of expression on this. Any ideas where the problem may...

Hi, I am getting illegal start of expression on this. Any ideas where the problem may be: public static void main(String args []){ private String name; private double area; private int population; public Country(String name, double area, int population){ this.name = name; this.area = area; this.population = population; } public double getPopulationDensity() { return population / area; } public String getName() { return name; } public void setName(String name) { this.name = name; } public double getArea() { return area; } public void setArea(double area) { this.area = area; } public int getPopulation() { return population; } public void setPopulation(int population) { this.population = population; } } class CountryTest { public static void main(String[] args) { Country country = new Country("United States of America", 3797000, 327000000); System.out.println("Population density of " + country.getName() + " is " + country.getPopulationDensity() + " per square mile"); } }

Solutions

Expert Solution

public class Country {
    private String name;
    private double area;
    private int population;

    public Country(String name, double area, int population) {
        this.name = name;
        this.area = area;
        this.population = population;
    }

    public double getPopulationDensity() {
        return population / area;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getArea() {
        return area;
    }

    public void setArea(double area) {
        this.area = area;
    }

    public int getPopulation() {
        return population;
    }

    public void setPopulation(int population) {
        this.population = population;
    }

    public static void main(String[] args) {
        Country country = new Country("United States of America", 3797000, 327000000);
        System.out.println("Population density of " + country.getName() + " is " + country.getPopulationDensity() + " per square mile");
    }
}


Related Solutions

Hi I am having the following problem. At the moment I am trying to create a...
Hi I am having the following problem. At the moment I am trying to create a bode plot for the following function. G(s)=(Ks+3)/((s+2)(s+3)) Note: Not K(s+2)! I then want to plot multiple bode plots for various values of K. Eg. 1,2,3, etc. I am having two separate issues. 1. How do I define the TF with a constant K in the location required (a multiple of s in the numerator) 2. How do I create multiple bode plots for values...
Hi! I am in an intro level Finance course and I am stuck on this problem....
Hi! I am in an intro level Finance course and I am stuck on this problem. Any help would be greatly appreciated. I am deciding on opening a restaurant. I was able to scrape together some capital from friends and family, but I must pay them back in 4 years at 12% per annum. I figure that it will cost me $165,000 to start up with rent, deposits, equipment, salaries, chicken, basil, rice, etc. for the first year, but I...
Hi I am getting error in implement some test case using Java. I am adding my...
Hi I am getting error in implement some test case using Java. I am adding my code and relevant files here, and the failed test. Please let me know where my problem is occuring and fix my code. Thanks! I will upvote. Implement a class to perform windowing of a Hounsfield value Implement the class described by this API. A partial implementation is provided for you in the eclipse project; however, unlike the previous class, very little work has been...
HI There, there is no solution for a problem that I am looking for. Advanced Accouting...
HI There, there is no solution for a problem that I am looking for. Advanced Accouting - Chapter 4, problem 30. Can you please assist? Thanks. Posada Company acquired 7,000 of the 10,000 outstanding shares of Sabathia Company on January 1, 2013, for $840,000. The subsidiary’s total fair value was assessed at $1,200,000 although its book value on that date was $1,130,000. The $70,000 fair value in excess of Sabathia’s book value was assigned to a patent with a 5-year...
Hi there, I am going to plan of a start-up "Fruits and vegetables organic " store...
Hi there, I am going to plan of a start-up "Fruits and vegetables organic " store So Can you help me to plan "Business Model Canvas" (understanding of BMC will not be assessed in this assessment.) If it is possible can you give me 1 reference as well please? ex: Heidarkhani, A., & khomami, A.A, & Jahanbazi, Q.,& Alipoor, H. (2013). The Role of Management Information Systems ( MIS ) in Decision-Making and Problems of its Implementation, Universal Journal of...
Hi, I am working on this assignment where we have to read and write to a...
Hi, I am working on this assignment where we have to read and write to a file. Change any code that needs to be changed, I need the wfile and rfile functions to be edited to work and the rest of the program. please change the gets() to something that works. if I need to create a .txt file to run the program pls let me know Thanks in advance for the help //agalloc.c // maintains list of agents infile,...
Hi, I am not able to find the correct steps and answers to solve this problem....
Hi, I am not able to find the correct steps and answers to solve this problem. Please help. Thanks! A bank offers your firm a revolving credit arrangement for up to $61 million at an interest rate of 1.48 percent per quarter. The bank also requires you to maintain a compensating balance of 2 percent against the unused portion of the credit line, to be deposited in a noninterest-bearing account. Assume you have a short-term investment account at the bank...
Hi, I am not able to find a correct complete answer to this problem ..can you...
Hi, I am not able to find a correct complete answer to this problem ..can you help with the answer, please? I cannot figure out year 3 and the NPV. H. Cochran, Inc., is considering a new three-year expansion project that requires an initial fixed asset investment of $2,280,000. The fixed asset falls into the three-year MACRS class (MACRS Table). The project is estimated to generate $2,210,000 in annual sales, with costs of $1,200,000. The project requires an initial investment...
I am getting confused on finding the ethical challanges to this question. I am understanding but...
I am getting confused on finding the ethical challanges to this question. I am understanding but second guessing my answers when it come to the elements and the Ethical Code Standards. 1. Identify an ethical challenge for each element (a-d) of Dr Lux advertising plan. Which General Principles and Ethical Code Standards best help understand why these elements may create ethical problems? Explain why. Case 5. Web-Based Advertising. Dr. Lux, an applied developmental psycholgoist, has created his own community consulation...
Java ArrayList Parking Ticket Simulator, Hello I am stuck on this problem where I am asked...
Java ArrayList Parking Ticket Simulator, Hello I am stuck on this problem where I am asked to calculate the sum of all fines in the policeOfficer class from the arraylist i created. I modified the issueParking ticket method which i bolded at the very end to add each issued Parking ticket to the arrayList, i think thats the right way? if not please let me know. What I dont understand how to do is access the fineAmountInCAD from the arrayList...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT