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
What is partnership.<br>List the advantages and disadvantages of partnership.​
oee [108]

Answer:

Disadvantages of a partnership include that: the liability of the partners for the debts of the business is unlimited. each partner is 'jointly and severally' liable for the partnership's debts; that is, each partner is liable for their share of the partnership debts as well as being liable for all the debts.

Explanation:

7 0
3 years ago
Read 2 more answers
Harrelson Company manufactures pizza sauce through two production departments: Cooking and Canning. In each process, materials a
riadik2000 [5.3K]

Solution:

Instructions Journalize the April transactions:

Date                           Account Titles and Explanation

4/30                              Work in Process—Cooking

                                     Work in Process—Canning

                                                     Raw Materials Inventory

4/30                              Work in Process—Cooking

                                     Work in Process—Canning

                                                              Factory Labor

4/30                             Work in Process—Cooking

                                   Work in Process—Canning

                                                  Manufacturing Overhead

4/30                             Work in Process—Canning

                                    Work in Process—Cooking

Cooking and out the debits

Debit                               Credit          

22,800

10,900                             33,700      

9,400

7,230                              16,630

33,800

28,100                            61,900

55,900                          

                                      55,900

6 0
3 years ago
Eeeee I need help siks djnakwidbdh
Vladimir79 [104]

Answer: skits?

Explanation:

5 0
3 years ago
Scenario 13-20 suppose that a given firm experiences decreasing marginal product of labor with the addition of each worker regar
Viktor [21]

Answer:

U-shaped

Explanation:

Since the marginal product of labor is decreasing, the average variable costs and marginal costs will be increasing at all points, but the average fixed costs will be decreasing. That is why the average total costs (which includes both variable and fixed costs per unit) will be U-shaped since they will fall at the beginning when the decrease in marginal product of labor is small, bu then will increase as the marginal product of labor falls even more.

7 0
3 years ago
An important basic characteristic of common stocks that makes them a suitable type of investment for the separate account of var
ziro4ka [17]

Complete Question:

An important basic characteristic of common stocks that makes them a suitable type of investment for the separate account of variable annuities is:

Group of answer choices

A) the safety of the principal invested.

B) changes in common stock prices tend to be more closely related to changes in the cost of living than changes in bond prices.

C) the yield is always higher than mortgage yields.

D) the yield is always higher than bond yields.

Answer:

B) changes in common stock prices tend to be more closely related to changes in the cost of living than changes in bond prices.

Explanation:

An important basic characteristic of common stocks that makes them a suitable type of investment for the separate account of variable annuities is changes in common stock prices tend to be more closely related to changes in the cost of living than changes in bond prices.

Generally, common stocks are considered by financial experts or broker-dealers to be a suitable type of investment of variable annuities because the prices of common stocks in the market are not fixed and as such they are affected by economical changes such as inflation or recession.

5 0
3 years ago
Other questions:
  • A friend and fellow student shares her employment experience over the last 12-week summer break. It took her one full week to fi
    9·1 answer
  • An opportunity cost: Multiple Choice Requires a current outlay of cash. Is an unavoidable cost because it remains the same regar
    7·2 answers
  • If an investment of $45,000 is earning an interest rate of 8.50% compounded annually, it will take for this investment to grow t
    8·1 answer
  • What is the purpose of using two different techniques to determine the densities of these two metals?
    12·1 answer
  • Assume that you have been hired as a consultant by CGT, a major producer of chemicals and plastics, including plastic grocery ba
    8·1 answer
  • The Federal Reserve can influence the federal funds interest rate by buying securities, which ________ reserves, thereby _______
    13·1 answer
  • By what percentage did​ mydeco's revenues grow each year from 2010 to​ 2013?b. by what percentage did net income grow each​ year
    13·1 answer
  • If a company is funded by a government grant is it A. For profit buisiness B. Non profit orginization C. Bankrupted buisiness D.
    15·1 answer
  • On October 31, Year 1, A company general ledger shows a checking account balance of $8,415. The company’s cash receipts for the
    12·1 answer
  • Define consumer protection agency​
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!