Questions
from Big Java Early Objects 7th edition Question Declare an interface Filter as follows: public interface...

from Big Java Early Objects 7th edition

Question
Declare an interface Filter as follows:

public interface Filter { boolean accept(Object x); }

Modify the implementation of the Data class in Section 10.4 to use both a Measurer and a Filter object. Only objects that the filter accepts should be processed. Demonstrate your modification by processing a collection of bank accounts, filtering out all accounts with balances less than $1,000.

Solve Exercise •• P10.6, using a lambda expression for the filter.

How would you use a use a lambda expression for the filter class?????
below is working code for the first part of the question, thanks.

*******************************************************************************

Filter.java <- needs to be lambda expression
public interface Filter
{
// this is what sifts through the -1000 and +1000 accounts
boolean accept(Object anObject);
}

below classes for
*******************************************************************************

BalanceFilter.java
public class BalanceFilter implements Filter
{
@Override
public boolean accept(Object object)
{
return ((BankAccount) object).getBalance() >= 1000;
}
}

*******************************************************************************
Measurer .java
public interface Measurer
{   
double measure(Object anObject);
}

*******************************************************************************

public class BankAccount
{
private double balance;
  
public BankAccount()
{
balance = 0;
}
  
public BankAccount(double initialBalance)
{
balance = initialBalance;
}
  
public void deposit(double amount)
{
balance = balance + amount;
}
  
public void withdraw(double amount)
{
balance = balance - amount;
}
  
public double getBalance()
{
return balance;
}
  
public void addIntrest(double rate)
{
balance = balance + balance * rate/100;
}
  
}

*******************************************************************************

DataSet.java
public class DataSet
{

public static double average(Object[] objects, Measurer meas, Filter filt)
{
double sum = 0;
double avg = 0;
int count = 0;
  
for (Object ob : objects)
{
if (filt.accept(ob))
{
sum += meas.measure(ob);
count++;
}
}
  
if (count > 0)
{
avg = (double)sum/count;
}
  
return avg;
}
  
public static void main (String[] args)
{

BankAccount accounts[] = new BankAccount[]
{
new BankAccount(200),
new BankAccount(1500),
new BankAccount(1000),
new BankAccount(2000),
new BankAccount(3000),
new BankAccount(0),
new BankAccount(50),
};
  
BalanceMeasurer measurer = new BalanceMeasurer();
BalanceFilter filter = new BalanceFilter();
  
double avg = average(accounts, measurer, filter);
System.out.println("Average for bank accounts with 1000.00 in collateral is "+avg);
}   
}

*******************************************************************************

BalanceMeasurer.java
public class BalanceMeasurer implements Measurer
{
public double measure(Object object)
{
return ((BankAccount) object).getBalance();
}
  
}

In: Computer Science

CRITAL THINKING: 1) Melanie, a breast cancer patient receiving chemotherapy, comes into your office for her...

CRITAL THINKING:

1) Melanie, a breast cancer patient receiving chemotherapy, comes into your office for her normal treatment. Upon examination, it is revealed that Melanie is experiencing flulike symptoms. The physician asks you to order a CBC. What results might you expect for a patient with Melanie’s characteristics, and why? Why might Melanie be experiencing flulike symptoms?

In: Nursing

need to write program on python, without using any other libraries like panda, numpy, etc. here...

need to write program on python, without using any other libraries like panda, numpy, etc.

here is google link on csv file https://drive.google.com/file/d/1O3cC9JAPVkXSrddTR6RocpSV8NMHrmRx/view?usp=sharing

There is a csv file, which is exel file, very big and what program should do:

- Read a CSV file 'annual.csv' enterprise into a data structure

- Count the number of rows and columns

- Determine if the data contains empty values (should search in all rows)

- Replace the empty values by 'NA' for strings, '0' for decimals and '0.0' for floats (in all rows)

- Transform all Upper case characters to Lower case characters (in every word)

- Transform all Lower case characters to Upper case characters (in every word in file)

- save back the 'repaired' array as csv and show edited version

- Print out the size of the data (number of rows, number of columns)

the file approzimately looks like this, but it is very huge

In: Computer Science

2.     The dataset QuizPulse10 contains pulse rates collected from 10 students in a class lecture and...

2.     The dataset QuizPulse10 contains pulse rates collected from 10 students in a class lecture and then from the same ten students during a quiz. We might expect the mean pulse rate to increase under the stress of a quiz. Use the dataset to test at the 5% significance level whether there is evidence to support this claim.

a.     Perform the hypothesis test in Minitab.

b.    Make a decision and mathematically justify your decision

c.     Interpret the results.

student quiz lecture
1 75 73
2 52 53
3 52 47
4 80 88
5 56 55
6 90 70
7 76 61
8 71 75
9 70 61
10 66 78

In: Math

Problem 24-3A Departmental income statements; forecasts LO P3 Williams Company began operations in January 2017 with...

Problem 24-3A Departmental income statements; forecasts LO P3

Williams Company began operations in January 2017 with two operating (selling) departments and one service (office) department. Its departmental income statements follow.

WILLIAMS COMPANY
Departmental Income Statements
For Year Ended December 31, 2017
Clock Mirror Combined
Sales $ 250,000 $ 105,000 $ 355,000
Cost of goods sold 122,500 65,100 187,600
Gross profit 127,500 39,900 167,400
Direct expenses
Sales salaries 21,000 6,900 27,900
Advertising 1,900 700 2,600
Store supplies used 950 600 1,550
Depreciation—Equipment 1,900 700 2,600
Total direct expenses 25,750 8,900 34,650
Allocated expenses
Rent expense 7,070 3,660 10,730
Utilities expense 2,700 2,000 4,700
Share of office department expenses 12,000 7,500 19,500
Total allocated expenses 21,770 13,160 34,930
Total expenses 47,520 22,060 69,580
Net income $ 79,980 $ 17,840 $ 97,820


Williams plans to open a third department in January 2018 that will sell paintings. Management predicts that the new department will generate $56,000 in sales with a 65% gross profit margin and will require the following direct expenses: sales salaries, $8,500; advertising, $1,100; store supplies, $1,000; and equipment depreciation, $900. It will fit the new department into the current rented space by taking some square footage from the other two departments. When opened, the new painting department will fill one-fifth of the space presently used by the clock department and one-fourth used by the mirror department. Management does not predict any increase in utilities costs, which are allocated to the departments in proportion to occupied space (or rent expense). The company allocates office department expenses to the operating departments in proportion to their sales. It expects the painting department to increase total office department expenses by $7,500. Since the painting department will bring new customers into the store, management expects sales in both the clock and mirror departments to increase by 11%. No changes for those departments’ gross profit percents or their direct expenses are expected except for store supplies used, which will increase in proportion to sales.

Required:
Prepare departmental income statements that show the company’s predicted results of operations for calendar-year 2018 for the three operating (selling) departments and their combined totals. (Do not round intermediate calculations. Round your final answers to nearest whole dollar amount.

In: Accounting

Select a retail business from the list below. The business must sell products, not services. -  ...

  1. Select a retail business from the list below. The business must sell products, not services.
    -   A camping supply store
    -   A candy business
    -   A high-end children's clothing store which only uses natural fibers
    -   Deli / sandwich shop
  2. Describe the business and the product(s) you plan to sell.
  3. Using Porter's Five Forces Model - analyze your business (use the Detroit metropolitan area as your local market).
    Provide an analysis on all 5 Porter's forces with respect to your business   
    a. Provide an analysis of each power and what it means relative to your business
    b. Explain how each "power" ranks for this business - high / med / low / etc.
  4. Using Porter's 3 generic business strategies, choose a business focus
    a. Identify where your products /business align
    b. Describe why you would align that way?
  5. Research CRM Capabilities
    a. List 3 capabilities / techniques that you will use for your business.
    b. Provide a description and comparison of each and why they would work for your business

In: Operations Management

Using ERP software, one can cut down on data duplication by keeping all your information within...

  1. Using ERP software, one can cut down on data duplication by keeping all your information within _______ cohesive system.

    multiple

    silo

    one

    departmental

1 points   

QUESTION 2

  1. Epicor ERP’s strengths include the amount of data it can store and analyze, as well as the automation it can provide when it comes to __________.

    customers

    vendors

    supply chain management

    production

1 points   

QUESTION 3

  1. Modern ERP practices began in the 1990s due to the rise of computer software being integrated with daily business____________.

    requirements

    costs

    operations

    expenditures

1 points   

QUESTION 4

  1. This is any ERP software which is deployed directly on your in-site devices.

    Open Source ERP

    On-premise ERP

    Cloud-based ERP

    Hybrid ERP

1 points   

QUESTION 5

  1. Odoo is a(n) _________ ERP and CRM used by over 4 million users worldwide.

    simple

    open-source

    limited

    closed

1 points   

QUESTION 6

  1. ERP communication tools organize scanned documents, files, emails, texts, and phone call recordings.

    True

    False

1 points   

QUESTION 7

  1. Microsoft is been a leader in the ERP software market for many years through its ________ product offerings.

    Iron Mountain

    Great Plains

    Solomon

    Dynamics

1 points   

QUESTION 8

  1. With SAP HANA, one doesn’t need to take the time to load data from your transactional database into your reporting database, or even build traditional tuning structures to enable that reporting.

    True

    False

1 points   

QUESTION 9

  1. Benefits of ERP Software include all except:

    Low implementation costs

    Streamlined workflows and processes

    Visibility into workflows

    Better financial planning and decision making

1 points   

QUESTION 10

  1. It is important to use an industry-specific ERP solution because:

    a general ERP system will weigh you down with unnecessary features

    a specialized ERP system will weigh you down with unnecessary features

    an industry-specific ERP system will cost less

    a general ERP system will cost more

1 points   

In: Computer Science

1. What is the cell emf (Eo cell) for electrolysis of molten nickel (II) iodide? (Use...

1. What is the cell emf (Eo cell) for electrolysis of molten nickel (II) iodide? (Use Eo values from Appendix E of your lecture text).

2. What reactions would take place at the anode and cathode during electrolysis of an aqueous solution of nickel (II) iodide?

3. Use the Nernst Equation (Equation 7) to calculate Ecell at 25o C for electrolysis of aqueous sodium chloride if the concentration of chlorine in the brine solution is 4.5 M and the partial pressure of Cl2 is 0.001 atmospheres.

4. Chlorine will spontaneously react with iodide to produce chloride and iodine. What is Eo for this reaction.

In: Chemistry

how has leaders choice in 21st century impacted the organization. give an example and reference to...

how has leaders choice in 21st century impacted the organization. give an example and reference to support your answer.

In: Operations Management

9. The price of an item depends on the order quantity: (ignore this row) Less than...

9. The price of an item depends on the order quantity:

(ignore this row)
Less than 100 pounds $ 20 per pound
100 pounds to 999 pounds $ 19 per pound
1,000 pounds or more $ 18 per pound

It costs $40 to place each order. Annual demand is 3,000 units. Carrying cost is 25 percent of the material price.

What is the optimal order quantity, and what would be its annual total cost? Go to at least two decimal places for your intermediate calculations. Round your answers to the nearest whole number.

Optimal order quantity    pounds
Total annual cost    (ignore this cell)

In: Operations Management

MATLAB Create two surface plots in the same figure window. Be sure to label the X...

MATLAB

  1. Create two surface plots in the same figure window. Be sure to label the X and Y axes and provide a title for each plot. The top 3D surface plot should use one of the equations

Option 1:Z=sinX+sinY

Option 2:Z=sinX+cosY

Option 3:Z=cosX+cosY

and the bottom 3D surface plot should use one of the equations

Option 1:Z=sinX - sinY

Option 2:Z=sinX - cosY

Option 3:Z=cosX - cosY

For both plots, use a mesh grid with the same range for both the x-axis and y-axis. Use a range of -2π to 2π; the step (increment) of both dimensions of the grid should be 0.25.

Use a menu or listdlg command to allow the user to select which functions to use. Be sure to output which option the user selected. And, use an if statement that, based on the option chosen, creates plots with the correct functions.

Run your program twice with different user input and provide the output for each run.

In: Computer Science

Describe and then discuss the major trends that have occurred in the following segments of the...

Describe and then discuss the major trends that have occurred in the following segments of the United States' balance of payments accounts in recent years: Merchandise trade balance, Investments in overseas assets by U.S. residents, and Investments in United States' assets by foreign residents.

In: Accounting

Suppose a set of students want to create a virtual study groups. The set consists of...

Suppose a set of students want to create a virtual study groups. The set consists of 86 students on the eastern timezone, and 47 students in non-eastern time zones. Of the students in the eastern timezone, only 12 are not in Boston.

i. Suppose each group is made of 2 students, one in the eastern time zone and one from noneastern timezone. How many possible study groups are there?

ii. Suppose each group is made of 3 students, one in Boston, one in the eastern time zone but not in Boston, and one from the non-eastern timezone. How many groups can we make?

iii.suggest the Boston students form study groups amongst themselves first. The groups must have at most 5 people for optimal studying. He then secures 3 rooms for these groups. Each room can be safely filled by at most 5 study groups. Show if the students can form the groups safely and the groups fit in these 3 rooms, then there must be at least 3 people in each group.

iv. With rooms set, the in-person study groups can begin. However, the Boston students want to let their remote fellows join via a virtual meetings. How many remote students are guaranteed to join the most welcoming in-person group?

show your steps, please

In: Computer Science

Smart sensor nodes can process data collected from sensors, make decisions, and recognize relevant events based...

Smart sensor nodes can process data collected from sensors, make decisions, and recognize relevant events based on the sensed information before sharing it with other nodes. In wireless sensor networks, the smart sensor nodes are usually grouped in clusters for effective cooperation. One sensor node in each cluster must act as a cluster head. The cluster head depletes its energy resources faster than the other nodes. Thus, the cluster-head role must be periodically reassigned (rotated) to different sensor nodes to achieve a long lifetime of wireless sensor network. Discuss in detail what are the major attributes required for choosing the optimal cluster head and explain how the choosing of optimal cluster head helps in
extending the lifetime of the wireless sensor networks, rotating the cluster-head role among sensor nodes with suppression of unnecessary data transmissions. ()

In: Computer Science

A certain advertising company has commissioned a study to determine if a recent advertising campaign is...

A certain advertising company has commissioned a study to determine if a recent advertising campaign is effective for certain age groups. Researchers have created a data file (results.txt) which contains the results attained by the study. The first column is the subject’s name (you may assume there is no whitespace in any name) and the second column indicates if the subject has seen the advertisement in question (Y or y means yes, N or n means no). The third column specifies the subject's age and the last column (the 'score') specifies how favorably the subject views the product being advertised (from 0 to 100 with a score of 100 being most favorable). A example of the file results.txt is attached. You should download this file to a convenient place on your hard drive. Please note that the file is a sample only. Your program should work on any data file that is formatted in a similar way.

results.txt example file -

Bailey           Y 16 68
Harrison         N 17 71
Grant            Y 20 75
Peterson         N 21 69
Hsu              Y 20 79
Bowles           Y 15 75
Anderson         N 33 64
Nguyen           N 16 68
Sharp            N 14 75
Jones            Y 29 75
McMillan         N 19 80
Gabriel          N 20 62
Huang            Y 62 21
Willoughby       Y 58 29
Davis            N 33 65
McGregor         Y 41 55

Your assignment is to prompt the user to enter the full pathname to the data file on disk. If the file does not exist in the specified location, your program should exit with a suitable error message.

The first thing your program should do is output to the screen a copy of the data read in from the disk file. This is known as “echoing” the input data. Your program should then calculate and display the the following results:

 Average score for subjects under 18 who have not seen the ad.

 Average score for subjects under 18 who have seen the ad.

 Average score for subjects 18 to 35 (inclusive) who have not seen the ad.

 Average score for subjects 18 to 35 (inclusive) who have seen the ad.

 Average score for subjects over 35 who have not seen the ad.

 Average score for subjects over 35 who have seen the ad.

Display your results to two places of decimals, and write your program to automatically list your six calculated averages one to a line, in the order above, along with a suitable label for each result.

Finally, your program should calculate and display to two places of decimals the overall average score for all of the subjects surveyed. (Note: Mathematically, this is NOT the average of the six averages you calculated previously).

Warning: There may be no subjects in any given category (such as over 35s who have not seen the ad). If so you cannot calculate the average (because you would get a divide by zero error) so instead of the average for that category you should display “No data to report”.

In: Computer Science