Question
Write a Java program to create a package named Pack1, with a class Extract. Create another package Pack2 inside Pack1 with two classes Sum and
Write a Java program to create a package named Pack1, with a class Extract. Create another package Pack2 inside Pack1 with two classes Sum and SumOfSquares in it. a. In the Extract class, define a method extractDigits() that will extract the digits of a number passed to it and store the extracted digits in an array. b. In the Sum class, define a method printSum() to find the sum of the elements of the array stored in Extract class. c. In the SumOfSquares class, define a method printSumofSquares() to find the sum of the squares of the array elements d. Define the main class and import the packages and call the methods under the classes Extract, Sum, SumOfSquares respectively.
Step 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