1

(JAVA) Programming Assignment 3 There are a number of zoos available to tourists. 1. Create a...

Question

(JAVA) Programming Assignment 3 There are a number of zoos available to tourists. 1. Create a...

(JAVA) Programming Assignment 3

There are a number of zoos available to tourists.

1. Create a Zoo class. Include data fields such as name of zoo, location, size, fee for the past 12 months, number of visitors recorded for the past 12 months, admission rates per visitor and annual budget. (20 points)

2. Include at least two mutators and two accessors. (15 points)

3. Include one default constructor and one more constructor. (15 points)

4. Write separate instance methods that implement: (30 points) a) return a string representing name of the zoo, the location and type of zoo; b) compute total admission based on admission rates and the number of visitors during the last 12 months; c) compute revenue from fees for the past year and total admission.

5. Create a second class to test your Zoo class. (20 points)

In your second class’s Main method, test your class by creating at least three new objects using the constructors or mutators you’ve created in your Zoo class. Each object will represent a specific zoo. Calculate and print revenue for each zoo.

Answers

Zoo.java

public class Zoo{

private String name, location;

private double size, fee, rate, budget;

public Zoo() {

size = 1000;

fee = 10;

rate = 2.5;

budget = 500000;

}

public Zoo(String name, String location, double size, double fee, double rate, double budget, int visitors) {

super();

this.name = name;

this.location = location;

this.size = size;

this.fee = fee;

this.rate = rate;

this.budget = budget;

this.visitors = visitors;

}

public double totalAdmissionCost() {

return visitors * rate;

}

public double totalRevenue() {

double revenue = fee + totalAdmissionCost();

System.out.println("Revenue of the zoo is " + revenue);

return revenue;

}

@Override

public String toString() {

return "Zoo [name=" + name + ", location=" + location + ", size=" + size + ", fee=" + fee + ", rate=" + rate

+ ", budget=" + budget + ", visitors=" + visitors + "]";

}

public String getName() {

return name;

}

public void setName(String name) {

this.name = name;

}

public String getLocation() {

return location;

}

public void setLocation(String location) {

this.location = location;

}

public double getSize() {

return size;

}

public void setSize(double size) {

this.size = size;

}

public double getFee() {

return fee;

}

public void setFee(double fee) {

this.fee = fee;

}

public double getRate() {

return rate;

}

public void setRate(double rate) {

this.rate = rate;

}

public double getBudget() {

return budget;

}

public void setBudget(double budget) {

this.budget = budget;

}

public int getVisitors() {

return visitors;

}

public void setVisitors(int visitors) {

this.visitors = visitors;

}

private int visitors;

}

Test.java

public class Test{

public static void main(String[] args) {

Zoo zoo1 = new Zoo("Corbett", "India", 25000, 1024, 2.8, 10000, 500);

System.out.println(zoo1);

Zoo zoo2 = new Zoo("RedStone", "UK", 12345, 424, 7.2, 124580, 800);

System.out.println(zoo2);

Zoo zoo3 = new Zoo("Venkara", "USA", 4527, 987, 10, 885000, 987);

System.out.println(zoo3);

}

}

<terminated> Test [Java Application] C:Program Files Javajre1.8.0_401bin\javaw.exe (06-Nov-2018, 8:19:48 AM) Zoo [name-Corbett, location-India, size-25000.0, fee-1824.0, rate-2.8, budget-10000.0, visitors-500] Revenue of the zoo is 2424.0 Zoo [name-Redstone, location«К, Revenue of the zoo is 6184.0 size-12345.0, fee-424.0, rate-7.2, budget-124580.0, visitors-800] Zoo [name-Venkara, location-USA, size-4527.0, fee-987.0, rate-10.0, budget-885000.0, visitors-987] Revenue of the zoo is 10857.0

Please check the code. If you have any doubts comment below and I am happy to help :)


Similar Solved Questions

1 answers
One more screenshot of the question. just to make it clear please help me the answer...
one more screenshot of the question. just to make it clear please help me the answer Find an equation for the line with the given properties. Express your answer using either the general form or the slope-intercept form of the equation of a line Containing the points (1.2) and (3.1) The equation i...
1 answers
On January 31, 2021, B Corp. issued $700,000 face value, 12% bonds for $700,000 cash. The...
On January 31, 2021, B Corp. issued $700,000 face value, 12% bonds for $700,000 cash. The bonds are dated December 31, 2020, and mature on December 31, 2030. Interest will be paid semiannually on June 30 and December 31. What amount of accrued interest payable should B report in its September 30, 2...
1 answers
Design a synthesis of ethyl N-(ethylimino)propanoate from ethyl formate, ethyl acetate, and ethyl propanoate. and CH3CH2...
Design a synthesis of ethyl N-(ethylimino)propanoate from ethyl formate, ethyl acetate, and ethyl propanoate. and CH3CH2 OCH2CH3 OCH2CH3 OCH CH3 OCH CH3 Part 1 out of 11 Choose the best option for the immediate electrophile precursor to the target molecule. CH3CH2 nucleophile OCH2CH3 electrophile &#...
1 answers
M 17-1 Journal Entries, Closing Entries, and Trial Balance LOS The general ledger trial balance of...
M 17-1 Journal Entries, Closing Entries, and Trial Balance LOS The general ledger trial balance of the General Fund of the City of Bedford on January 1, 2015, shows the following: Cash S100,000 Taxes Receivable 75.000 Allowance for Uncollectible Taxes $ 35.000 Fund Balance-Assigned (encumbrances fro...
1 answers
The wave function for a standing wave on a string is described by y(x, t) =...
The wave function for a standing wave on a string is described by y(x, t) = 0.016 sin(4πx) cos (57πt), where y and x are in meters and t is in seconds. Determine the maximum displacement and maximum speed of a point on the string at the following positions. (a) x = 0.10 m ymax =  m v...
1 answers
- Section of 4 par value) 1107002 the Year the On January 1, 2020, the stockholders'...
- Section of 4 par value) 1107002 the Year the On January 1, 2020, the stockholders' equity Sectio Sheffield corporation shows common stock ($41 $1,200,000; faid-in capital in excess of par and retained earnings $1,220,000. During the following treasury Stock transactions occurred. Mar. 1- Purch...
1 answers
The following inventory transactions took place for Oriole Corporation for the month of May: Date Event...
The following inventory transactions took place for Oriole Corporation for the month of May: Date Event May 1 beginning inventory May 5 purchase May 10 purchase May 15 sale May 20 sale May 22 purchase May 24 purchase May 25 sale Quantity 2,000 3,000 5,000 5,000 3,000 3,500 2,500 5,000 Cost/ Selline ...
1 answers
Question 37 (1 point) Figure 8-7 Price 522 o 5 10 15 20 25 30 35...
Question 37 (1 point) Figure 8-7 Price 522 o 5 10 15 20 25 30 35 40 45 50 Quantity Refer to Figure 8-7. What is the deadweight loss? ОООО...
1 answers
Use the table below to answer the following question(s). Fiberia Accessories, a clothing retailer, is planning...
Use the table below to answer the following question(s). Fiberia Accessories, a clothing retailer, is planning to introduce a new line of sweaters as part of the winter collection for $65 with an inventory of 1500. The main selling season is 60 days between November and December. The store then sel...
1 answers
1. Margaret carried out an experiment with a plant food that contained 0.31 grams of phosphate,...
1. Margaret carried out an experiment with a plant food that contained 0.31 grams of phosphate, PO. What mass of MgNH PO.6H O precipitate should she obtain? 2. Use dimensional analysis to convert 3.45 grams of phosphorus to grams of P2Os...
1 answers
45. • A spring of unstretched length L and spring constant k is attached to a...
45. • A spring of unstretched length L and spring constant k is attached to a wall and an object of mass M resting on a fric- tionless surface (Figure 12-24). The object is pulled such that the spring is stretched a distance A then released. Let the +x direc- tion be to the right. (a) What is t...
1 answers
A) A security system for a building has three ways of detecting an intruder. 1. Security...
a) A security system for a building has three ways of detecting an intruder. 1. Security camera (SC) which sends a 1 when an intruder is detected. 2. Motion sensor (MS) which sends a 0 when an intruder is detected. 3. Noise level detector (NLD) which sends a 1 when the noise level rises beyond a cer...
1 answers
FMA Inc has issued a $1000 par value bond that matures in 14 years. The bond...
FMA Inc has issued a $1000 par value bond that matures in 14 years. The bond pays semi-annual coupons at a rate of 7.5% APR compounded semi-annually, with first coupon payment due 6-months from today. What is the bond's price if the market requires a 9.5% yield to maturity on this bond?...
1 answers
3. An astronaut is on a spacewalk outside a spaceship. The spaceship has a mass of...
3. An astronaut is on a spacewalk outside a spaceship. The spaceship has a mass of 10000 kg and the astronaut has a mass of 50 kg. If she is 10 m away from the spaceship, a) what is the gravitational force on the astronaut? b) what is the acceleration of he astronaut?...
1 answers
Ment Score: 64% Resources Ex Give Up? Feedba Question 18 of 25 > For the reaction...
ment Score: 64% Resources Ex Give Up? Feedba Question 18 of 25 > For the reaction 8H,S(g) - 8H,(8) +Sg(8) = 0.520 M, and (Sg) = 0.750 M. the equilibrium concentrations were found to be [H S1 = 0.250 M, H at is the equilibrium constant for this reaction? Ko = 32.3 about en privacy policy Terms of ...
1 answers
Question 3 of 16 (1 point) 7.6 Section Exercise 1 Find the monthly payment on the...
Question 3 of 16 (1 point) 7.6 Section Exercise 1 Find the monthly payment on the loan. Assume that the term of the loan is 10 years. $6,500 at 6.9% interest; student graduates 3 years and 8 months after loan is acquired; payments deferred for 6 months after graduation. The monthly payment on this l...

-- 0.009414--