Write a complete static method named addUp that accepts, in order, an integer number and an integer...

90.2K

Verified Solution

Question

Programming

Write a complete static method named addUp thataccepts, in order, an integer number and aninteger thisMany as parameters and that prints acomplete line of output reporting all the numbers that result fromadding number to itself thisManynumber of times (starting at 1 and ending atthisMany). For example, the following calls:

addUp(3, 5);

addUp(7, 3);

should produce this output:

Adding up 3 for 5 times gives: 3, 6, 9, 12, 15

Adding up 7 for 3 times gives: 7, 14, 21

Notice that the answers are separated by commas and aspace. You must exactly reproduce this format. You mayassume that the number of add ups you will be asked to do(thisMany) is greater than or equal to 1. Yourmethod must work with any value of numberincluding negative numbers and zero.

Write a main method that tests your addUp method.

Answer & Explanation Solved by verified expert
3.9 Ratings (457 Votes)
public class temp public static void mainString args addUp3 5 Systemoutprintln addUp7 3    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students