Question

Some service fees (% of asset amount) of two investment companies are shown in the following...

Some service fees (% of asset amount) of two investment companies are shown in the following tables:

Company A:

Service Fee Type

Fee

Management Fee

1.5

Subscription Fee

5.0

Redemption Fee

1.0

Company B:

Service Fee Type

Fee

Platform Fee

0.2

Management Fee

1.0

Subscription Fee

2.0

The above information is to be stored in two maps (Map<String, Double>) referenced by companyA and companyB for Company A and Company B respectively. The service fee type is assumed to be unique in each map and it is the key of it.

  1. Write a program segment to store the above information of Company A in a map companyA. Remember to create it first.

  1. Assume that there are many entries in the map referenced by companyA. Using an enhanced for loop and an array, write a program segment to store the number of service fee types in each fee category using an element of the array. The fee categories are "fee <= 0.5", "0.5 < fee <= 1.0", and "fee > 1.0".

  1. Assume there are many entries in the maps and one company can have some service fee types not available in the other company. Write a program segment with an enhanced for loop to print out the name of each service fee available in both of the companies (A and

B) and its lowest fee. For example, the string "Subscription Fee, 2.0" is printed when we are considering "Subscription Fee".

0 0
Add a comment Improve this question Transcribed image text
Answer #1

a) program segment to create the 2 maps
       Map<String, Double> mapA = new HashMap<String, Double>();
       Map<String, Double> mapB = new HashMap<String, Double>();

       mapA.put("Management Fee", 1.5);
       mapA.put("Subscription Fee", 5.0);
       mapA.put("Redemption Fee", 1.0);
      
       mapB.put("Platform Fee", 0.2);
       mapB.put("Management Fee", 1.0);
       mapB.put("Subscription Fee", 2.0);

==========================================================================
b)program segment to store the fees in 3 categories in an array
       int[] counts = new int[3];
       Double fee;
       for(String s : mapA.keySet()) {
           fee = mapA.get(s);
           if(fee <= 0.5)
               counts[0]++;
           else if(fee <= 1.0)
               counts[1]++;
           else
               counts[2]++;
       }
      
===============================================
c) program segment to print out fees for service types available in both companies
      
       for(String s : mapA.keySet()) {
           if(mapB.containsKey(s)) {
               double f1 = mapA.get(s);
               double f2 = mapB.get(s);
               if(f1 < f2)
                   System.out.println(s + ", " + f1);
               else
                   System.out.println(s + ", " + f2);
               }
           }
       }

Add a comment
Know the answer?
Add Answer to:
Some service fees (% of asset amount) of two investment companies are shown in the following...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Use java programming for the following questions to have the solutions ready within today Jan 3...

    Use java programming for the following questions to have the solutions ready within today Jan 3 2020 at or before 7:00PM GMT+8 time zone: Question 13 Some service fees (% of asset amount) of two investment companies are shown in the following tables: Company A: Service Fee Type Fee Management Fee 1.5 Subscription Fee 5.0 Redemption Fee 1.0 Company B: Service Fee Type Fee Platform Fee 0.2 Management Fee 1.0 Subscription Fee 2.0 The above information is to be stored...

  • Lab Topics • The basics of Array object Use the following Coding Guidelines • When declaring...

    Lab Topics • The basics of Array object Use the following Coding Guidelines • When declaring a variable, you usually want to initialize it. Remember you cannot initialize a number with a string. Remember variable names are case sensitive. Use tabs or spaces to indent code within blocks (code surrounded by braces). Use white space to make your program more readable. Use comments after the ending brace of classes, methods, and blocks to identify to which block it belongs. Problem...

  • Required: 1. What is the amount of Apple’s accounts receivable as of September 30, 2017? 2....

    Required: 1. What is the amount of Apple’s accounts receivable as of September 30, 2017? 2. Compute Apple’s accounts receivable turnover as of September 30, 2017. 3. How long does it take, on average, for the company to collect receivables for fiscal year ended September 30, 2017? 4. Apple’s most liquid assets include (a) cash and cash equivalents, (b) short-term marketable securities, (c) accounts receivable, and (d) inventory. Compute the percentage that these liquid assets (in total) make up of...

  • Please read the case provided below and answer the following question: In 2007, JetBlue was a...

    Please read the case provided below and answer the following question: In 2007, JetBlue was a booming young airline with a strong reputation for outstanding service. In fact, the low-fare airline referred to itself as a customer service company that just happened to fly planes. But on Valentine's Day 2007, JetBlue was hit by the perfect storm-literally-of events that led to an operational meltdown. One of the most severe storms of the decade covered JetBlue's main hub at New York's...

  • JOHNSON & JOHNSON AND SUBSIDIARIES CONSOLIDATED STATEMENTS OF EARNINGS (Dollars and Shares in Millions Except Per...

    JOHNSON & JOHNSON AND SUBSIDIARIES CONSOLIDATED STATEMENTS OF EARNINGS (Dollars and Shares in Millions Except Per Share Amounts) (Note 1)* 2016 71,890 21,789 50.101 20,067 9.143 29 Sales to customers Cost of products sold Gross profit Selling, marketing and administrative expenses Research and development expense In-process research and development Interest income Interest expense, net of portion capitalized (Note 4) Other (income) expense, net Restructuring (Note 22) Eamings before provision for taxes on income Provision for taxes on income (Note 8)...

  • JOHNSON & JOHNSON AND SUBSIDIARIES CONSOLIDATED STATEMENTS OF EARNINGS (Dollars and Shares in Millions Except Per...

    JOHNSON & JOHNSON AND SUBSIDIARIES CONSOLIDATED STATEMENTS OF EARNINGS (Dollars and Shares in Millions Except Per Share Amounts) (Note 1)* 2016 71,890 21,789 50.101 20,067 9.143 29 Sales to customers Cost of products sold Gross profit Selling, marketing and administrative expenses Research and development expense In-process research and development Interest income Interest expense, net of portion capitalized (Note 4) Other (income) expense, net Restructuring (Note 22) Eamings before provision for taxes on income Provision for taxes on income (Note 8)...

  • JOHNSON & JOHNSON AND SUBSIDIARIES CONSOLIDATED STATEMENTS OF EARNINGS (Dollars and Shares in Millions Except Per...

    JOHNSON & JOHNSON AND SUBSIDIARIES CONSOLIDATED STATEMENTS OF EARNINGS (Dollars and Shares in Millions Except Per Share Amounts) (Note 1)* 2016 71,890 21,789 50.101 20,067 9.143 29 Sales to customers Cost of products sold Gross profit Selling, marketing and administrative expenses Research and development expense In-process research and development Interest income Interest expense, net of portion capitalized (Note 4) Other (income) expense, net Restructuring (Note 22) Eamings before provision for taxes on income Provision for taxes on income (Note 8)...

  • JOHNSON & JOHNSON AND SUBSIDIARIES CONSOLIDATED STATEMENTS OF EARNINGS (Dollars and Shares in Millions Except Per...

    JOHNSON & JOHNSON AND SUBSIDIARIES CONSOLIDATED STATEMENTS OF EARNINGS (Dollars and Shares in Millions Except Per Share Amounts) (Note 1)* 2016 71,890 21,789 50.101 20,067 9.143 29 Sales to customers Cost of products sold Gross profit Selling, marketing and administrative expenses Research and development expense In-process research and development Interest income Interest expense, net of portion capitalized (Note 4) Other (income) expense, net Restructuring (Note 22) Eamings before provision for taxes on income Provision for taxes on income (Note 8)...

  • JOHNSON & JOHNSON AND SUBSIDIARIES CONSOLIDATED STATEMENTS OF EARNINGS (Dollars and Shares in Millions Except Per...

    JOHNSON & JOHNSON AND SUBSIDIARIES CONSOLIDATED STATEMENTS OF EARNINGS (Dollars and Shares in Millions Except Per Share Amounts) (Note 1)* 2016 71,890 21,789 50.101 20,067 9.143 29 Sales to customers Cost of products sold Gross profit Selling, marketing and administrative expenses Research and development expense In-process research and development Interest income Interest expense, net of portion capitalized (Note 4) Other (income) expense, net Restructuring (Note 22) Eamings before provision for taxes on income Provision for taxes on income (Note 8)...

  • SYNOPSIS The product manager for coffee development at Kraft Canada must decide whether to introduce the...

    SYNOPSIS The product manager for coffee development at Kraft Canada must decide whether to introduce the company's new line of single-serve coffee pods or to await results from the product's launch in the United States. Key strategic decisions include choosing the target market to focus on and determining the value proposition to emphasize. Important questions are also raised in regard to how the new product should be branded, the flavors to offer, whether Kraft should use traditional distribution channels or...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT