Question: Exercise 1 : Create a class named Decimals. - Create a default private constructor ( with nothing inside of it ) . - Write a
Exercise : Create a class named Decimals.
Create a default private constructor with nothing inside of it
Write a static method named printDecimalDigits that takes a double as a parameter and does not return anything.
The method should print out "Digits after decimal point: On the next line, print out all the digits after the decimal point on one line separated by spaces do not include the decimal point On the line after that, print out the sum of all of the digits after the decimal point.
Additional rules: You can only use wrapper classes and the String methods: length charAt indexOf You may use at most one loop and there should be no conditional blocks inside of your loop.
begintabularcc
hline Method Call & Method Output
hline Decimals.printDecimalDigits; & begintabularl
Digits after decimal point:
Sum:
endtabular
hline Decimals.printDecimalDigits; & begintabularl
Digits after decimal point:
Sum:
endtabular
hline Decimals.printDecimalDigits; & begintabularl
Digits after decimal point:
Sum:
endtabular
hline
endtabular
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
