Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a method that takes an integer number ( either positive or negative ) , and finds and returns the largest digit in that number.

Write a method that takes an integer number (either positive or negative), and finds and returns the largest digit in that number.
Requirements:
Do not use arrays in your solution.
Do not convert integer into a string in order to extract digits. Use % operator instead.
Start coding with TwoMethodsA03.zip Download TwoMethodsA03.zip
Make sure to write method code according to the specifications and test them using unit tests provided in TwoMethodsA03.zip Download TwoMethodsA03.zip
Do not add any imports to the project - all packages needed for solution are already imported.
Do not alter any of the tests. If your code is not passing a test, find and fix errors in your method implementation rather than changing the test code.
No partial credit will be given for a method that fails even one test.
Two Methods fractionSum() method
Write a method that calculates and returns sum of fractions 1/2+2/3+...+ n/(n+1) where value n is passed as parameter and defines the length of the pattern and the sum. The method returns -1 if the value of n is less than 1.
Examples:
fractionSum(1)=1/2
fractionSum(2)=1/2+2/3
fractionSum(3)=1/2+2/3+3/4
fractionSum(5)=1/2+2/3+3/4+4/5+5/6
fractionSum(0)=-1
Start coding with TwoMethodsA03.zip Download TwoMethodsA03.zip
Make sure to write method code according to the specifications and test them using unit tests provided in TwoMethodsA03.zip Download TwoMethodsA03.zip
Do not add any imports to the project - all packages needed for solution are already imported.
Do not alter any of the tests. If your code is not passing a test, find and fix errors in your method implementation rather than changing the test code.
No partial credit will be given for a method that fails even one test.

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

Database Systems For Advanced Applications Dasfaa 2023 International Workshops Bdms 2023 Bdqm 2023 Gdma 2023 Bundlers 2023 Tianjin China April 17 20 2023 Proceedings Lncs 13922

Authors: Amr El Abbadi ,Gillian Dobbie ,Zhiyong Feng ,Lu Chen ,Xiaohui Tao ,Yingxia Shao ,Hongzhi Yin

1st Edition

3031354141, 978-3031354144

More Books

Students also viewed these Databases questions

Question

JI 0 3 m 3 / sI 1 0 0 ( ) 1 0 m 1 8 m 4 m

Answered: 1 week ago