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
A firm has sales of $1.8 million, and 20 percent of the sales are for cash. The year-end accounts receivable balance is $225,000
Juliette [100K]

Answer:

The average collection period is 56.25 days

Explanation:

The average collection period is the number of days' sales in receivables and calculated by using following formula:

The number of days' sales in receivables = 360/Accounts receivable turnover ratio

Accounts Receivable Turnover = Net Credit Sales/Accounts Receivable

Net Credit sales = Total Sales - the sales are for cash = $1,800,000 - 20% x $1,800,000 = $1,440,000

Accounts Receivable Turnover = $1,440,000/$225,000 = 6.4 times

The number of days' sales in receivables = 360/6.4 = 56.25 days

7 0
2 years ago
During the month of June, Ace Incorporated purchased goods from two suppliers. The sequence of events was as follows: June 3 Pur
Alinara [238K]

Answer and Explanation:

The journal entries are shown below:

On June 3

Merchandise Inventory $4,100

                   To Accounts payable $4,100

(Being the purchase of goods on credit is recorded)  

On Jun 5

Accounts payable $1,100  

         To Merchandise   Inventory  $1,100

(To record purchase returns)  

On June 6

Merchandise Inventory $1,000

     Accounts payable  $1,000

(Being the purchase of goods on credit is recorded)  

On June 11

Accounts payable ($4,100 - $1,100) $3,000

               To Cash  $2,960

               To  Inventory ($4,100 - $1,100) × 2%  $60

(Being the payment is recorded)  

On June 22

Accounts Payable $2,000     ($3,000 - $1,000)

    To Cash  $2,000

(Being the payment on account in full is paid)

4 0
3 years ago
A(n) ________ breach of a contract occurs when a party renders inferior performance of his or her contractual obligations.
DanielleElmas [232]
The answer to this question is a material breach. A material breach is a breach of contract where in the other party failed to provide or perform what is needed in the contract. This also shows that the contract can no longer be completed.
6 0
3 years ago
Oromyx Inc., a manufacturer of home appliances, received consumer complaints about its product demonstration and installation se
Klio2033 [76]

Answer:

B) customer satisfaction

Explanation:

Customer satisfaction is a measure that shows how happy the customers are with the products and services of the company. In this scenario, the work team improved the customer satisfaction because when the employees were trained, they were able to offer a better service which increased customer satisfaction and this was reflected in the service ratings and the rise in sales.

4 0
3 years ago
Over the past 100 years or so, Binney and Smith's Crayola crayons have become household staples in more than 80 countries around
Vesna [10]

Answer: Maturity stage

Explanation:

Maturity stage tends to occur after growth and introduction stages. Maturity stage is known as one of the longest stages of product life cycle. Under this stage, the sales growth tends to decline; the organization tends to reach the highest point under a demand cycle; and thus advertising strategies tend to have a minimal impact on their sales growth.

4 0
3 years ago
Read 2 more answers
Other questions:
  • Mark decides to only pay the minimum payment each month of $15 for his credit card. He continues to charge purchases to the cred
    11·1 answer
  • Why does Maureen Riehl state that internet retailers have an "unfair price advantage" when they don't collect sales tax from out
    5·1 answer
  • "Much of the information that allows decision makers to run their organizations effectively in the digital age comes to them in
    5·2 answers
  • Stickiness is an important attribute for which revenue model?
    10·1 answer
  • Scoring at least 80 percent on the next anatomy test is a specific goal.<br> True or false
    7·2 answers
  • Given the increasing use of computers to do routine tasks, which of the following skills is most likely to be actively sought by
    8·1 answer
  • Wilma, Betty, and Fred are partners who share income and losses in a 5:3:2 ratio. Wilma decides to retire from the partnership w
    8·1 answer
  • Which is bigger, in size? 300oz/900g OR 3.5lb
    9·2 answers
  • Olaoaoaosoodjsdujbcjhdhdjshdskdj dhehehkb
    6·1 answer
  • What was the growth rate of per capita income in india on the eve of independence.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!