Question: Write a complete Java program, induding comments in both the main program and in each method, which will do the following: The main program will
Write a complete Java program, induding comments in both the main program and in each
method, which will do the following:
The main program will start by calling a method named introduction which will print out a
description of what the program will do at the top of the first output page. This first method is
called just once.
This method will not be sent any parameters, and it will not return a value. It will print several
lines of output explaining what the program does, and it will explain how the program should end
see step
The main program will ask the user to type in four integer values, positive, negative, or zero
see step The main program will print the four numbers right after they are read in
The main program will call a method named findsum sending it the four integer values.
The method will determine the sum of the larger of the four values and subtract the smallest
value, sending the answer back to the main program.
The main program will print the value returned. For example, if you send to the method,
the method will return and the main program will print that is the sum.
The main program will call a method named printmyname sending it one parameter the
sum of the integer values calculated in step The method will print your name that many
times, and the method will not return a value. Be careful see below.
For example, if the parameter to the method is then the method should print your name
times. If the parameter is the method should print your name times.
However, if the parameter sent in is less than or equal to or if the parameter sent in is
greater than the method will say it is not cossible to print the name. For example, if the
parameter is the method will say in this case it is not possible to print the name since the
number is negative. If the parameter is the method will say it is not possible to print the
name because it has to print it too many times.
The main program will call a method named howmanyeven, sending it all four integers. The
method will determine how many or of the values are even and return that value to
the main program. Hint: Even means divisible by with no remainder, and there is an operator
that will tell you the remainder.
The main program will print an appropriate message: There isare even numbers
Then the main program will skip a few lines and go back to step
At step if the user types in a special combination, the program will go to after step
You must determine what this combination is and you must explain itin a prompt or in a
comment, and in the introduction at the beginningto the person using the program.
At the end, print how manv sets of four data values were entered and processed. Make sure
that this value is at least
DATA: You will be judged on the quality of your data.
Type in a total of at least sets of data values.
Have at least two sets where the sum is less than
Have at least two sets where the sum is more than
Have at least four sets where you do print your name one or more times.
Be sure to include both and as valid sets.
STYLE: Be sure that each method has a good comment explaining two things: exactly what
parameters the method will receive, and exactly what the method will do for example, if it
parameters the method will receive, and exacty what the method will dofor exarnple, if it returns an answer or prints. For each method, mention the method's parameters by name in the
comment.
OUTPUT: Here is some sample output ignoring the introduction:
the four original integers are
the four original integers are the sum is remember minus a minus adds five
it is not possible to print the name because it will print too many times
there isare even numbers
the three original integers are
the sum is
your name
your name
your name
your name your name
your name
your name there isare even your name printed times
Optional
At the end, print the total number of times your name was printed.
At the end, print the largest value ever computed for the sum. Print the smallest value ever
computed for the sum!
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
