PLEASE INCLUDE COMMENTS
In java
Create a Java Program
/*
* Java program to add even numbers recurssively
*/
import java.util.Scanner;
import java.util.*;
// Declaration of class
class recSum{
// main method execution starts from here
public static void main(String[] args){
// Declaration of variable
int choice = 0;
// Iterates while user input quit condition
do{
// promot message for user
System.out.print("\nEnter number: ");
int number = getInteger(); // call function
// it checks for possitive integer no
if(number > 0){
recEvenSum(number, 0);
}
else{
System.out.println("Enter Possitive no only");
}
// promot message for user
System.out.println("\nPress 0 to continue, 1 to Quit");
choice = getInteger(); // call function
}while(choice != 1); // checks for terminating condition
}
// this function return integer value input from user
public static int getInteger(){
// create object for scanner class
Scanner i = new Scanner(System.in);
int number = 0;
// iterate while valid input
for(boolean test = false; test == false;){
try{
number = i.nextInt(); // get input from console
test = true;
return number; // return to calling function
}
// throws error if input not integer
catch(InputMismatchException e){
System.out.println("Invalid input");
}
i.nextLine(); // nextInt() function tripping on subsequent calls so its required
}
return number;
}
// recursive function for finding sum of even no's takes two parameters
public static void recEvenSum(int number, int sum){
// iterate while greater than 0
if(number >= 0){
// checks for even no
if(number % 2 == 0){
sum += number; // add number to sum
recEvenSum(number - 2, sum); // recursive call
}else
recEvenSum(number - 1, sum);
}else{ // print final sum
System.out.println("The recursive Even no's Sum: " + sum );
}
}
}



PLEASE INCLUDE COMMENTS In java Create a Java Program Add the following comments at the beginning...
***Please give the java code for the below and add comments for different areas for a dummy to understand*** This java program will combine the techniques of handling arrays, decision control statements, and loops. Your program should accomplish the following: Build an array that holds characters (size 35) Load the array with random capital letters (use random generator) Your program should present a menu to the user allowing for the following “actions”. To “search” for a target letter of the...
Java Code please read comments and add the code to required lines....LINE 1 to LINE 5 ********************************************************************** * Program Summary: This program demonstrates these basic Java concepts: * - Creating an array based on user input * - Accessing and displaying elements of the array * * The program should declare an array to hold 10 integers. * The program should then ask the user for an integer. * The program should populate the array by assigning the user-input integer...
using java code Create a program that has a main method and a recursive method: isPalindrome – recursive method that will receive a String and will return a Boolean that will evaluate whether the String is a palindrome or not. The main method will also ask the user for a word/phrase and using the recursive method isPalindrome it will print a message whether the word/phrase is a palindrome or not.
In this lab, you complete a partially written Java program that includes two methods that require a single parameter. The program continuously prompts the user for an integer until the user enters 0. The program then passes the value to a method that computes the sum of all the whole numbers from 1 up to and including the entered number. Next, the program passes the value to another method that computes the product of all the whole numbers up to...
In this lab, you complete a partially written Java program that includes two methods that require a single parameter. The program continuously prompts the user for an integer until the user enters 0. The program then passes the value to a method that computes the sum of all the whole numbers from 1 up to and including the entered number. Next, the program passes the value to another method that computes the product of all the whole numbers up to...
Write a small program using C++, that does the following using the Conditional Operator only. Prompts user to input a score between 1-6 (assume the user will honor the request) Stores the user input in an appropriate variable (appropriate in type and name) Checks if the score is a passing grade. Assume 70% or more is needed Displays a message if the score is passing or if the score is not a passing score Include a test table in the...
Be sure to include a message to the user explaining the purpose of the program before any other printing to the screen. Be sure to include information about which document codes are valid. Within the main method, please complete the following tasks in java program: Create a loop that allows the user to continue to enter two-character document designations until a sentinel value is entered (ex. “XX”). If the user enters a valid document code, please echo that value back...
in JAVA please please include a main() and show output!!
Create a GUI program shown below. User enters information
through the first window. When “Close” button is clicked, your
program stops; when “Show Info” button is clicked, the input
information is displayed on the TextArea; while when “Modify”
button is clicked, the second window pops up and the information
user enters to the first window automatically fills in the second
window. User can change the information on the second window....
Create the following programs in Java {Java1 difficulty} [Please create as simple as possible] a. Ask the user to enter their favorite number and favorite word. Pass both of these values to a method that will print the favorite word vertically the favorite number of times. b. Ask the user to enter 2 integers. Pass the integers to 2 different methods: one method to add the integers and print the sum (from the method); the second method to multiply the...
Design a calculator program that will add, subtract, multiply, or divide two numbers input by a user.Your program should contain the following:-The main menu of your program is to continue to prompt the user for an arithmetic choice until the user enters a sentinel value to quit the calculatorprogram.-When the user chooses an arithmetic operation (i.e. addition) the operation is to continue to be performed (i.e. prompting the user for each number, displayingthe result, prompting the user to add two...