Question: must be in java: Create a class named Problem1 Create an instance value named value. Create a constructor that sets the variable value to an
must be in java:
Create a class named Problem1
Create an instance value named value.
Create a constructor that sets the variable value to an integer argument named v.
Create a method named addComma. It will return a String and will not have an argument.
Create a String variable named commaNumber;
Create an integer named thousands.
Create an integer named hundreds.
Assign to thousands the result of dividing value by one thousand.
Assign to hundreds the result of using the modulus operator to find the remainder of dividing value by one thousand.
Assign to commaNumber thousands + a comma + hundreds
Return commaNumber.
Create a tester class named Problem1Tester (Reminder all tester classes have a main method)
Import Scanner
Create a Scanner object
Prompt for a number between 1,000 and 99,999
Get the number from the user and store it in a variable.
Create a Problem1 object
Print the result from addComma (this can be done directly in the print statement or you can create a new variable and print it)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
