Question: Java For this project, you will create a program that asks the user to enter a positive integer value less than 20. If the user

Java

For this project, you will create a program that asks the user to enter a positive integer value less than 20.

If the user enters a number greater than 20, the user should get an error.

If the user enters a number equal to or less than 20, display the double of each value beginning with 1 up to the selected number (multiply each number by 2), then provide the total of all doubles.

For example, if the user entered the number 5, the following should display:

Double up 1 = 2

Double up 2 = 4

Double up 3 = 6

Double up 4 = 8

Double up 5 = 10

Total = 30

You will be using mutator and accessor method. A mutator method is simply a fancy name for a method that modifies private data. An accessor method is a method which has the sole purpose of providing access to private data.

Minimum Requirements:

Create a class that has 3 methods.

1. A mutator method should take the number from the user and store it in a private variable. ()

2. Another method should perform the calculations, display the double up results and store the total in a private variable. This method must use a loop.

3. An accessor method should display the total.

Create a main method that creates an object of your class and calls each of the methods of the class.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!