Answered step by step
Verified Expert Solution
Question
1 Approved Answer
no arrays, system.outprint. please use for / while loops thank you sn=(t1,t2,t3,,tn) such that ti=t1+(i1)d and 1in In other words, the sequence has n terms,
no arrays, system.outprint. please use for / while loops thank you
sn=(t1,t2,t3,,tn) such that ti=t1+(i1)d and 1in In other words, the sequence has n terms, the first term of the sequence is t1, and the difference between each two consecutive terms is d. Implement a method called getSeqStat which takes as inputs 3 integer parameters: the first term (t1) of the sequence, a common difference (d), and size (n). The method should return a string value containing n items: { item 1, item 2,, item n} size (1in). For example: item m4 contains the sum and product of the sub-sequence (t1,t2,t3, t4) The String return value must conform to the following format for the items (item1, item 2,, , item n) : 1. All items are wrapped within curly braces (\{\}) and separated by semicolons (;) and a space. 2. Each item is wrapped within square brackets ([]) and contains the sum and product of the corresponding sub-subsequence. 3. Subsequences are wrapped within angle brackets (). For example. the calls: - getSeqstat (10,5,2) represents the sequence s3=(10,15). The first term is 10 , the difference is 5 and the size is 2 . The return string of the method should contain 2 items containing sum and product for the sequences (10), and (10, 15). The output should look like this: {[10:10,10];[10,15:25,150]} getSeqStat (4,6,5) represents the sequence s5=(4,10,16,22,28). The first term is 4 , the difference is 6 and the size is 5 . The return string of the method should contain 5 items containing sum and product for the sequences (4), (4,10),(4,10,16),(4,10,16,22), and (4, 10,16,22,28) The output would be: {[:4,4];[:14,40];[:30,640];[:52,14080];[:80,394240]} All items above should be wrapped within curly braces ({}) and separated by semicolons (;) and a space except the last item. There is one space after each comma (,) and colon (:) after each sequenceStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started