Questions
Java Question I have a Queue containing String type taking in a text file with an...

Java Question

I have a Queue containing String type taking in a text file with an iterator.

I need to use ArrayList and HashMap for freqHowMany to get a frequency table in descending order by the highest frequency words in the text. Any help would be much appreciated and thanks!

final Iterator input = new Scanner(System.in).useDelimiter("(?U)[^\\p{Alpha}0-9']+");
        final Queue queueFinal = new CircularFifoQueue<>(wordsLast);

        while (input.hasNext()) {
            final String queueWord = input.next();
            if (queueWord.length() > minimumLength) {
                queueFinal.add(queueWord); // the oldest item automatically gets evicted
            }

            System.out.println(queueFinal);
        }
    }
}

EXAMPLE:

Your program prints an updated word cloud for each sufficiently long word read from the standard input.

The program takes up to three positive command-line arguments:

  • freqHowMany indicates the size of the word cloud, i.e., the number of words in descending order of frequency to be shown
  • wordMinLength indicates the minimum length of a word to be considered; shorter words are ignored
  • wordLastNwords indicates the size of a moving window of n most recent words of sufficient length for which to update the word cloud

Your program then reads a continuous stream of words, separated by whitespace or other non-word characters, from the standard input. (A word can have letters, numbers, or single quotes.) For each word read, your program prints to standard output, on a single line, a textual representation of the word cloud of the form

The idea is to connect this tool to a streaming data source, such as Twitter, or speech-to-text from a 24-hour news channel, and be able to tell from the word cloud in real time what the current "hot" topics are.

THANKS!

In: Computer Science

1. Calculate the NPV for the following project if the firm's cost of capital is 8.2%....

1. Calculate the NPV for the following project if the firm's cost of capital is 8.2%.

Year

0

1

2

3

4

5

Cash Flow

-$3,250,000

$625,000

$750,000

$1,250,000

$1,000,000

$975,000

A.   $274,698
B.   $342,130
C.   $384,956
D.   $196,999

2.Assuming that the cash flows are reinvested at the company's cost of capital, which is 6.8%, what is the Modified Internal Rate of Return (MIRR) for the following project?

Year

0

1

2

3

Cash Flow

-$600,000

$300,000

$150,000

$175,000

A.   4.127%
B.   9.836%
C.   10.241%
D.   6.507%

3.Calculate the Payback Period for the following investment.

Year

0

1

2

3

4

5

Cash Flow

-$3,250,000

$625,000

$750,000

$1,250,000

$1,000,000

$975,000

A. 2.875 years
B.   2.325 years
C.   3.625 years
D.   4.175 years

In: Finance

An ideal Rankine cycle with reheat uses water as the working fluid. As shown in the...

An ideal Rankine cycle with reheat uses water as the working fluid. As shown in the figure below, the conditions at the inlet to the first turbine stage are 1600 lbf/in.2, 1200°F and the steam is reheated to a temperature of T3 = 800°F between the turbine stages at a pressure of p3 = p2 = 400 lbf/in.2

For a condenser pressure of p5 = p4 = 5 lbf/in.2, determine:

(a) the quality of the steam at the second-stage turbine exit.

(b) the cycle percent thermal efficiency.

In: Mechanical Engineering

CPP Task: You are to write a class called Monomial, using filenames monomial.h and monomial.cpp, that...

CPP Task: You are to write a class called Monomial, using filenames monomial.h and monomial.cpp, that will allow creation and handling of univariate monomials, as described below.

Monomial Description

Each monomial object has following properties:

  • Each monomial has a coefficient and a power.
  • Monomial power is always positive.
  • Monomial power is always integer.
  • Monomials cannot be added if they have different powers

Class Details

  1. The single constructor for the Monomial class should have 2 parameters: an floating point coefficient value (optional, with a default value of 1.0); and an integer power value (optional, with a default value of 1). If the power value is less then 1, set the power to 1. The class will need to provide internal storage for any member data that must be kept track of.

  2. There should be member functions GetCoefficient, and GetPower, which will return the monomial’s coefficient value, and monomial’s power value, respectively. The GetPower method should return integer results. The GetCoefficient function should return its result as a float.

  3. There should be member functions SetPower, which will set the monomial’s power to the arbitrary positive value. If the parameter is not positive then set the power to the default value 1.

  4. There should be member function Add, which adds the one monomial to the other. The parameter of this member function need to be a constant reference to the other monomial object. The monomials can only be added if they have the same power, otherwise error message must be printed. The result of the addition is saved in the caller object.

  5. There should be two member functions Multiply (overrides), which each allow to multiply a monomial to a number and to another monomial. The first member function need to accept floating point parameter that is used to perform multiplication of the real number on the the monomial object. The second member function need to accept a constant reference to the other monomial object. Use monomials to coefficients and powers to perform their multiplication. The result of the multiplication is saved in the caller object.

  6. There should be a member function called Exponent that perform exponentiation (raise to power) of the monomial to the specified power value. You only can raise monomial to the positive power, if the power parameter is not positive print error message. The result of the exponentiation is saved in the caller object.

  7. A sample driver program (called monomial-driver.cpp) is provided. It uses objects of type Monomial and illustrates sample usage of the member functions.

  8. Your class declaration and definition files must work with my main program from the test driver, as-is (do not change my program to make your code work!). You are encouraged to write your own driver routines to further test the functionality of your class, as well. Most questions about the required behavior of the class can be determined by carefully examining my driver program and the sample execution. Keep in mind, this is just a sample. Your class must meet the requirements listed above in the specification - not just satisfy this driver program. (For instance, I haven’t tested every illegal fill character in this driver program - I’ve just shown a sample). Your class will be tested with a larger set of calls than this driver program represents.

General Requirements

  • No global variables, other than constants!
  • All member data of your class must be private
  • You can only use the <iostream> library for output. !!! No other libraries are allowed !!!.
  • When you write source code, it should be readable and well-documented.
  • Here are some general notes on style guidelines
  • Your monomial.h file should contain the class declaration only. The monomial.cpp file should contain the member function definitions.

Test Driver:

//
// driver.cpp -- driver program to demonstrate the behavior of
//               the Monomial class

#include <iostream>
#include "monomial.h"

using namespace std;

int main()
{
    // create some monomial: x, 2x, 12.5x³, -3xâ¶
    Monomial m1, m2( 2.0 ), m3( 12.5, -1 ), m4( -3.0 , 6);
    // display monomial
    cout << "Monomial `m1` has the coefficient " << m1.GetCoefficient()
         << " and power " << m1.GetPower() << ": ";
    m1.Print();
    cout << "Monomial `m2` has the coefficient " << m2.GetCoefficient()
         << " and power " << m2.GetPower() << ": ";
    m2.Print();
    cout << "Monomial `m3` has the coefficient " << m3.GetCoefficient()
         << " and power " << m3.GetPower() << ": ";
    m3.Print();
    cout << "Monomial `m4` has the coefficient " << m4.GetCoefficient()
         << " and power " << m4.GetPower() << ": ";
    m4.Print();

    // Change monomial power
    cout << "Monomial `m3` power wasn't changed: ";
    m3.SetPower(-1);
    m3.Print();
    cout << "Monomial `m3` power was changed: ";
    m3.SetPower(3);
    m3.Print();

    // can add monomials with the same powers
    cout << "Monomial addition" << endl;
    m1.Add(m2);
    cout << "x + 2x = ";
    m1.Print();
    // cannot add monomials with different powers
    cout << "x³ + 12.5x³ = ";
    m2.Add(m3);

    // can multiply monomial to a number
    cout << "Monomial multiplication by a number" << endl;
    m2.Multiply(2.5);
    cout << "2x * 2.5 = ";
    m2.Print();

    // can multiply monomials
    cout << "Monomial multiplication by a monomial" << endl;
    m3.Multiply(m4);
    cout << "12.5x³ * -3xⶠ= ";
    m3.Print();

    // can raise monomial to the power
    cout << "Monomial exponentiation" << endl;
    m4.Exponent(3);
    cout << "(-3xâ¶)³ = "; // -27x^18
    m4.Print();
    cout << "(3x)â° = "; // -27x^18
    m1.Exponent(-10);

    return 0;
}

Test Driver Output

Monomial `m1` has the coefficient 1 and power 1: 1x^1
Monomial `m2` has the coefficient 2 and power 1: 2x^1
Monomial `m3` has the coefficient 12.5 and power 1: 12.5x^1
Monomial `m4` has the coefficient -3 and power 6: -3x^6
Monomial `m3` power wasn't changed: 12.5x^1
Monomial `m3` power was changed: 12.5x^3
Monomial addition
x + 2x = 3x^1
x³ + 12.5x³ = Cannot add monomials with different powers
Monomial multiplication by a number
2x * 2.5 = 5x^1
Monomial multiplication by a monomial
12.5x³ * -3x⁶ = -37.5x^9
Monomial exponentiation
(-3x⁶)³ = -27x^18
(3x)⁰ = Can raise only to a positive power

In: Computer Science

8 Food and Beverage The following Course Outcomes are assessed in this Assignment. AB213-4: Explain the...

8 Food and Beverage

The following Course Outcomes are assessed in this Assignment.

AB213-4: Explain the process for purchasing, receiving, storing, and producing a food item.

GEL-2.01: Communicate the impact of mathematical results in a discipline specific situation.

Scenario: The Shelton Hospital needs chicken for dinner to be served a week from this coming Saturday and it is being ordered today for this 250 bed hospital. The vendor provides shipment within three days of ordering in a frozen state.

  • Describe the purchasing and include the specifications (see Chapter 6) that would be included in the Purchase Order (i.e., PO) for the 100 pounds of bone-in chicken.
  • Describe the receiving and the inspection process concerning the chicken.
  • Explain the storing, thawing methods, temperature, and subsequent preparation process for the 100 pounds of bone-in chicken based on the state in which it arrived, the arrival date, and serving date (show the dates for each step).
  • Explain the production process steps for preparing just the roast chicken entrée (i.e., main course) cut into eight pieces for the hospital for one night’s dinner. Show your calculations for the dinner to demonstrate sufficient servings. Specify all the steps from beginning to service.

In: Operations Management

Aria Acoustics, Inc. (AAI), projects unit sales for a new seven-octave voice emulation implant as follows:...

Aria Acoustics, Inc. (AAI), projects unit sales for a new seven-octave voice emulation implant as follows:

Year Unit Sales
1 73,600
2 86,600
3 105,750
4 97,900
5 67,600

Production of the implants will require $1,650,000 in net working capital to start and additional net working capital investments each year equal to 20 percent of the projected sales increase for the following year. Total fixed costs are $3,500,000 per year, variable production costs are $258 per unit, and the units are priced at $384 each. The equipment needed to begin production has an installed cost of $17,100,000. Because the implants are intended for professional singers, this equipment is considered industrial machinery and thus qualifies as seven-year MACRS property. In five years, this equipment can be sold for about 25 percent of its acquisition cost. The tax rate is 23 percent the required return is 15 percent. MACRS schedule

a.

What is the NPV of the project? (Do not round intermediate calculations and round your answer to 2 decimal places, e.g., 32.16.)

b. What is the IRR? (Do not round intermediate calculations and enter your answer as a percent rounded to 2 decimal places, e.g., 32.16.)

In: Accounting

Why is it important for companies to develop a sales Force? List five (5) advantages of...

  1. Why is it important for companies to develop a sales Force? List five (5) advantages of developing a Sales Force:

In: Operations Management

Explain why the brain interprets top-down processing information the way that it does. Explain your OPINON...

Explain why the brain interprets top-down processing information the way that it does. Explain your OPINON as to why these differences exist. Also, Provide the definition of both sensation and perception, as well as stimuli, IN YOUR OWN WORDS. How do they differ? How are they related?

In: Psychology

Discuss the role of warm water in the formation and persistence of a hurricane, referencing your...

Discuss the role of warm water in the formation and persistence of a hurricane, referencing your observations about Sea Surface Tempature in the Atlantic and Gulf and what happened to Katrina after landfall.

In: Other

Explain the types of voluntary benefits that can be included in a compensation package.

Explain the types of voluntary benefits that can be included in a compensation package.

In: Operations Management

1/Your team was asked to program a self-driving car that reaches its destination with minimum travel...

1/Your team was asked to program a self-driving car that reaches its destination with minimum travel time.

Write an algorithm for this car to choose from two possible road trips. You will calculate the travel time of each trip based on the car current speed and the distance to the target destination. Assume that both distances and car speed are given.

2/

Write a complete Java program that do the following:

  1. Declare String object and a variable to store your name and ID.
  2. DisplayYour Name and Student ID.
  3. Display Course Name, Code and CRN
  4. Replace your first name with your mother/father name.
  5. Display it in an uppercase letter.

Note:Your program output should look as shown below.

My Name: Ameera Asiri

My student ID: 123456789

My Course Name: Computer Programming

My Course Code: CS140

My Course CRN: 12345

AIYSHA ASIRI

Note: Include the screenshot of the program output as a part of your answer.

3/

Write a tester program to test the mobile class defined below.

Create the class named with your id (for example: Id12345678) with the main method.

  1. Create two mobiles M1 and M2 using the first constructor.
  2. Print the characteristics of M1 and M2.
  3. Create one mobile M3 using the second constructor.
  4. Change the id and brand of the mobile M3. Print the id of M3.

Your answer should include a screenshot of the output. Otherwise, you will be marked zero for this question.

public class Mobile {

private int id;

private String brand;

public Mobile() {

    id = 0;

    brand = "";

}

public Mobile(int n, String name) {

    id = n;

    brand = name;

}

public void setBrand(String w) {

    brand = w;

}

public void setId(int w) {

    id = w;

}

Public int getId() {

return id;

}

public String getBrand() {

return brand;

}

}

4/

Write a method named raiseSalary that accepts two integers as an argument and return its sum multiplied by 15%. Write a tester program to test the method. The class name should be your ID (for example: Id12345678).

Your answer should include a screenshot of the output. Otherwise, you will be marked zero for this question.

In: Computer Science

13.1 Radical Rewrite: Rescuing a Slapdash Résumé (Obj. 4) The following poorly organized and written résumé...

13.1 Radical Rewrite: Rescuing a Slapdash Résumé (Obj. 4)

The following poorly organized and written résumé needs help to remedy its misspellings, typos, and inconsistent headings.

Your Task. By using the information in the resume, revise Isabella’s resume into a correctly formatted one-page chronological resume. Please read the resume section of your textbook, review the grading rubric and the chronological resume samples that I uploaded into Blackboard under Ch12 Writing Assignment.

Résumé of Isabella R. Jimenez

1340 East Phillips Ave., Apt. D Littleton, CO 80126

Phone 455-5182 • E-Mail: [email protected]

OBJECTIVE

I’m dying to land a first job in the “real world” with a big profitable company that will help me get ahead in the accounting field.

SKILLS

Word processing, Internet browsers (Explorer and Google), Powerpoint, Excel, type 40 wpm, databases, spreadsheets; great composure in stressful situations; 3 years as leader and supervisor and 4 years in customer service

EDUCATION

Arapahoe Community College, Littleton, Colorado. AA degree Fall 2013

Now I am pursuing a BA in Accounting at CSU-Pueblo, majoring in Accounting; my minor is Finance. My expected degree date is June 2015; I recieved a Certificate of Completion in Entry Level Accounting in December 2012.

I graduated East High School, Denver, CO in 2009.

Highlights:

· Named Line Manger of the Month at Target, 08/2009 and 09/2010

· Obtained a Certificate in Entry Level Accounting, June 2012

· Chair of Accounting Society, Spring and fall 2013

· Dean’s Honor List, Fall 2014

· Financial advisor training completed through Primerica (May 2014)

· Webmaster for M.E.Ch.A, Spring 2015

Part-Time Employment

Financial Consultant, 2014 to present

I worked only part-time (January 2014-present) for Primerica Financial Services, Pueblo, CO to assist clients in refinancing a mortgage or consolidating a current mortgage loan and also to advice clients in assessing their need for life insurance.

Target, Littleton, CO. As line manager, from September 2008-March 2012, I supervised 22 cashiers and front-end associates. I helped to write schedules, disciplinary action notices, and performance appraisals. I also kept track of change drawer and money exchanges; occasionally was manager on duty for entire store.

Mr. K’s Floral Design of Denver. I taught flower design from August, 2008 to September, 2009. I supervised 5 florists, made floral arrangements for big events like weddings, send them to customers, and restocked flowers.

In: Operations Management

Fill in the blanks in the table below. Country Nominal GDP growth Population growth Inflation Real...

Fill in the blanks in the table below.

Country

Nominal
GDP growth

Population
growth

Inflation

Real GDP
growth per capita

Svea

4%

3%

% ??

-1%

Bonifay

3%

1%

0%

% ??

Chaires

% ??

2%

6%

4%

Drifton

5%

1%

-2%

%

Estiffanulga

7%

% ??

2%

4%

In: Economics

1. Consider a project having the following seven activities:                                 &

1. Consider a project having the following seven activities:

                                                                        Optimistic        Most likely      Pessimistic

                                          Immediate              Time (o)          Time (m)         Time (p)

            Activity                 Predecessors         (weeks)           (weeks)           (weeks)

                  A                     none                            4                      7                      9

                  B                     none                            3                      5                      8

                  C                     A                               2                      4                      6

                  D                     A, B                            6                      9                      9

                  E                      C, D                            5                      5                      5

                  F                      B                               2                      5                      9

                  G                     E, F                             3                      3                      6

(a) What is the expected time for each activity?

(b) What is the expected project completion time?

(c) What is the critical path?

(d) What are the expected time and variance of each path?

(e) What is the probability that the project will be completed in less than 22 weeks?

In: Operations Management

In this module, we read Sarah Deer’s monograph, The Beginning and End of Rape, in which...

In this module, we read Sarah Deer’s monograph, The Beginning and End of Rape, in which she explores the historical and ongoing brutal effects of sexual violence on Native women. In your critical reflection, please address these three questions: 1. First explain why describing the rape of Native women as an “epidemic” is inaccurate. In other words, what about rape as a phenomenon warrants a different description?
2. Next discuss how we can consider the combination of federal laws and policies that govern Native communities a modern extension of U.S colonialism that diminishes tribal sovereignty. How do these laws and policies perpetuate sexual violence against Native Americans?
3. Finally, explore Federal versus Native responses to and legal proceedings for incidents of rape. What does Deer say about the specific ideologies, historical narratives, and types of methods to address rape that are
effective, ineffective, and that prioritize Native women’s well-being?

In: Psychology