1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
k0ka [10]
3 years ago
12

Write the AddressList method newBusiness. This method searches addresses for an existing business with an identical address (i.e

. an address object for which street matches st and number matches no). If this is found, then the method updates the item in the list to an address with name nm, street st and number no. If no entry with a matching street and number exists, then the method adds a new address to the end of the list with name nm, street st and number no. The method should return the index on Addresses where the address has been updated or added.
Business
1 answer:
max2010maxim [7]3 years ago
5 0

Answer:

See explaination

Explanation:

// Address.java

public class Address {

/**

* The name of the business

*/

private String name;

/**

* The name of the street the business is on

*/

private String street;

/**

* The street number of the business

*/

private int number;

/**

* Constructs an Address that represents a business with name nm,

* at number no on the street st

*/

public Address(String nm, String st, int no)

{

name = nm;

street = st;

number = no;

}

/**

* Returns the name of the business

*/

public String getName()

{

return name;

}

/**

* Returns the name of the street on which the business is located

*/

public String getStreet()

{

return street;

}

/**

* Returns the street number of the business

*/

public int getNumber()

{

return number;

}

}

//end of Address.java

//AddressBook.java

import java.util.ArrayList;

import java.util.List;

public class AddressBook {

/**

* The list of business addresses. No two businesses in the list

* can have the same address (both the same street and street number)

*/

private List<Address> addresses;

/**

* Constructs an empty AddressBook

*/

public AddressBook()

{

addresses = new ArrayList<Address>();

}

/**

* atparam st the name of a street

* atreturn a list with the names of each business with an address on that street

*/

public List<String> onStreet(String st)

{

// create an empty output list of names of business

List<String> businessName = new ArrayList<String>();

// loop over the list of addresses

for(int i=0;i<addresses.size();i++)

{

// if ith street of address = nm, add the name of the business to the output list

if(addresses.get(i).getStreet().equalsIgnoreCase(st))

businessName.add(addresses.get(i).getName());

}

return businessName; // return the list

}

/**

* Searches for an existing business with an identical address (street and number

* both match). Updates the record to an address with name nm, street st and number no.

* If no entry already exists adds a new address to the end of the list with these parameters.

*

* atparam nm the name of the business

* atparam st the street the business is on

* atparam no the street number of the business

* atreturn the index of where the business address is on the list

*/

public int newBusiness(String nm, String st, int no)

{

// loop over the list of addresses

for(int i=0;i<addresses.size();i++)

{

// if ith index addresses match the street and number of the input st and no

if((addresses.get(i).getStreet().equalsIgnoreCase(st)) && (addresses.get(i).getNumber() == no))

{

addresses.remove(i); // remove the ith address from list

addresses.add(i, new Address(nm,st,no)); // add a new address with the input name, street and number at ith index

return i; // return the index i

}

}

// if no address match, add the business at the end of the list

addresses.add(new Address(nm,st,no));

return addresses.size()-1; // return the last index

}

}

//end of AddressBook.java

You might be interested in
Zahn company manufactures a product that sells for $120. a selling commission of 10% of the selling price is paid on each unit s
sweet [91]
The contribution margin is the difference between sales volume and variable costs.
 Or to put it another way: the contribution margin is the profits of a company, without considering the fixed costs.
 We have then:
 MC = $ 120 -60 $ = $ 60
 Answer:
 the contribution margin per unit is $ 60
3 0
3 years ago
Please answer this question...
oee [108]

Answer: yes! Aww thanks, you too :))

Explanation: have a great day!!

5 0
3 years ago
Read 2 more answers
Suppose that consumption depends on the interest rate. how if at all does this alter the conclusions
zalisa [80]
Here is the answer. Suppose that consumption depends on the interest rate, how this alters the conclusions is that at any given level of the interest rate, national saving falls by the change in government purchases. You should also consider <span>what happens when government purchases increase. Hope this helps.</span>
3 0
3 years ago
Raggs, Ltd. a clothing​ firm, determines that in order to sell x​ suits, the price per suit must be p=120 - 0.5 x. It also deter
kodGreya [7K]

Answer:

A) R(x) = 120x - 0.5x^2

B) P(x) = - 0.75x^2 + 120x - 2500

C) 80

D) 2300

E) 80

Explanation:

Given the following :

Price of suit 'x' :

p = 120 - 0.5x

Cost of producing 'x' suits :

C(x)=2500 + 0.25 x^2

A) calculate total revenue 'R(x)'

Total Revenue = price × total quantity sold, If total quantity sold = 'x'

R(x) = (120 - 0.5x) * x

R(x) = 120x - 0.5x^2

B) Total profit, 'p(x)'

Profit = Total revenue - Cost of production

P(x) = R(x) - C(x)

P(x) = (120x - 0.5x^2) - (2500 + 0.25x^2)

P(x) = 120x - 0.5x^2 - 2500 - 0.25x^2

P(x) = - 0.5x^2 - 0.25x^2 + 120x - 2500

P(x) = - 0.75x^2 + 120x - 2500

C) To maximize profit

Find the marginal profit 'p' (x)'

First derivative of p(x)

d/dx (p(x)) = - 2(0.75)x + 120

P'(x) = - 1.5x + 120

-1.5x + 120 = 0

-1.5x = - 120

x = 120 / 1.5

x = 80

D) maximum profit

P(x) = - 0.75x^2 + 120x - 2500

P(80) = - 0.75(80)^2 + 120(80) - 2500

= -0.75(6400) + 9600 - 2500

= -4800 + 9600 - 2500

= 2300

E) price per suit in other to maximize profit

P = 120 - 0.5x

P = 120 - 0.5(80)

P = 120 - 40

P = $80

8 0
3 years ago
Which hmmwv variant is the primary vehicle carrying the s250 electrical equipment shelter?
KonstantinChe [14]

Its usually the M1152 model of hmmwvs

6 0
3 years ago
Other questions:
  • Jason rents rooms in his hotel for an average of $100 per night. the variable cost per rented room is $20. his fixed costs are $
    7·1 answer
  • Claire purchases an eight-year callable bond with a 10% annual coupon rate payable semiannually. The bond has a face value of 3,
    13·1 answer
  • G morrisey &amp; brown, ltd., of sydney is a merchandising company that is the sole distributor of a product that is increasing
    8·1 answer
  • JRN Enterprises just announced that it plans to cut its dividend from $2.50 to $1.50 per share and use the extra funds to expand
    11·1 answer
  • What type of business organization should Luke, Austin, and R.J.<br> adopt?<br> Why?
    5·1 answer
  • &lt;
    11·1 answer
  • When screening prospective new ventures, venture capital firms must consider the nature of the proposed industry Which of the fo
    15·1 answer
  • You own factory A and factory B. The next cash flow for each factory is expected in 1 year. Factory A has a cost of capital of 3
    14·1 answer
  • XYZ Company bought real estate properties in Boston 50 years ago for $30,000. In 2020, a real estate appraiser inspects the prop
    14·1 answer
  • a) A person has 5 trousers, 7 shirts, 6 ties, and 3 pairs of shoes. In how many possible distinct ways can the person dress
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!