Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

package eecs.hm; import java.util.List; import java.util.Map; public class M4 { /* Given a list of elements each of which is a list of strings containing

package eecs.hm; import java.util.List; import java.util.Map; public class M4 { /*  Given a list of elements each of which is a list of strings containing  expenses made on food items, consolidate the expenses and return a map  whose keys are the expense names and whose values are the total spent  per expense. The expenses are expressed in the strings as an expense name  (a word) followed by a colon followed by the expense amount (an integer).   For example, if the incoming list is:   [[Milk:12, Bread:3, Banana:4, Soup:2], [Honey:6, Bread:1, Milk:3]]   then the return would be:   {Banana=4, Bread=4, Honey=6, Milk=15, Soup=2}   As you can see, the amounts for Bread and Milk are obtained by adding  up their respective amounts in the two incoming lists.   */  public static Map expense(List> list) { return null; // delete me!  } } 
package eecs.hm; public class M1 { /*  Given a positive integer n, return the number of "palindro additions" needed  to make it a palindrome (i.e. reads the same left-to-right and right-to-left).  A "palindro addition" is the addition of the number to its inverse.   For example, if n = 159 then the first palindro addition yields 159+951=1110,  and the second palindro addition yields 1110+111=1221, which is a palindrome.  Hence, the palindro count of 159 is 2.   If n is already a palindrome then return zero, and if the number does not  become a palindrome after 10 palindro additions then return -1.   */  public static int palindroCount(int n) { return -1; // delete me!  } } 
package eecs.hm; public class M2 { /*  Given a non-empty string,determine the longest sequence of repeating characters  in it (i.e. consecutive characters that are the same) and return the repeating  character and its repetition count delimited by an equal sign. If more than one  such sequence is found, the return should be about the one that occurs first in  the string.   Example: longest("ZZZZAISSDRRIIIIIIIHHHQQQDDDDDDDZZZZZDD") returns "I=7" because  there are two longest repeating sequences in this string (D and I, each repeating  7 times) and the I sequence occurs before the D sequence.   */  public static String longest(String s) { return null; // delete me!  } } 
ackage eecs.hm; import java.util.Date; import java.util.List; public class M3 { /*  Given a non-empty list of strings each of which represents a date, return  the two dates in it that are closest to each other.   The date in each string is expressed like "30/3/17@11:30 pm"; i.e. one or  two digits for the day followed by a slash followed by one or two digits  for the month followed by a slash followed by 2 or 4 digits for the year.  The time has one or two digits for the hour followed by a colon followed  by exactly two digits for the minute followed by one space followed by  am or pm in upper, lower, or mixed case. The date and time are delimited  by the @ character.   The return is a chronologically sorted list of two date objects. If any of  the incoming strings is invalid, return null. And if the list has more than  one pair of dates that are equally close, return the pair that occurs first.   Example: if the given list is:  [30/3/17@11:30 pm, 31/12/2016@11:10 PM, 1/4/2017@6:00 am, 8/8/2016@12:00 aM, 1/1/2017@5:45 AM, 31/3/17@4:30 aM]  then the return would be the list:  [Thu Mar 30 23:30:00 EDT 2017, Fri Mar 31 04:30:00 EDT 2017]   */   public static List closest(List list) { return null; // delete me!  } } 

image text in transcribed

Applicati L Course LEVEECs102 x PT RMast visitedv 3Yar University Fronk FECs 3 course web Pages 3 R occs Latest Headlines aunches a HM BS SQR My Appucation-t-/Androidstudi. Thu 11x01 D

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Issues In Database Management A Refernce For The Thinking Practitioner

Authors: Fabian Pascal

1st Edition

0201485559, 978-0201485554

More Books

Students also viewed these Databases questions

Question

1. Who will you assemble on the team?

Answered: 1 week ago

Question

4. Who would lead the group?

Answered: 1 week ago