Explanation of Solution
Program:
File name: “Inbetween.java”
//Import necessary header files
import java.util.Scanner;
//Define a class named Inbetween
public class Inbetween
{
//Define main method
public static void main(String args[])
{
//Declare a flag variable
int flag;
//Create an object for Scanner class
Scanner flag1=new Scanner(System.in);
//Prompt the user to enter the first number
System.out.println("Enter first number:");
int first=flag1.nextInt();
//Prompt the user to enter the second number
System.out.println("Enter second number:");
int second=flag1.nextInt();
//If first number is greater than second number
if(first > second)
{
/*For loop to execute every integer between the entered numbers*/
for(flag=second;flag<=first;flag++)
{
//Print the result
System.out...
Trending nowThis is a popular solution!
- In Java Create a class WhileEvent3, write code that asks the user to enter a positive or negative number or 'x' 'X' to quit the program. When out of the loop the sum of all numbers entered is printed. READ THE USER'S input as String an not as integer.arrow_forwardWrite an application that prompts a user for the number of years the user has until retirement and then the amount of money the user can save annually. If the user enters 0 or a negative number for either value, reprompt the user until valid entries are made. Assume that no interest is earned on the money. Display the amount of money the user will have at retirement. import java.util.Scanner; public class RetirementGoal { public static void main (String[] args) { // your code here } }arrow_forwardJAVA PPROGRAM Please Modify this program with further modifications as listed below: ALSO, take out and change the following in the program: System.out.println("Program terminated."); because the test case does not need it And change this in the program: Please enter the file name or type QUIT to exit:\n so it reperats once for every test case because it repeats twice in every case as shown in the screenshot. I only need it once. I have provided the failed the test cases and the inputs as a screenshot. The program must pass the test case when uploaded to Hypergrade. import java.io.*;import java.util.ArrayList;import java.util.Scanner;public class SymmetricalNameMatcher { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String fileName; do { // Prompt the user to enter a file name or 'QUIT' to exit. System.out.print("Please enter the file name or type QUIT to exit:\n"); fileName =…arrow_forward
- PLEASE DONT COPY OFF OTHER POSTS CODE help with java..plzz paste indented code add comments tooarrow_forwardThis must be done in Java.util.scanner. Class. Everything must have comments Write a Java application that displays two dialog boxes in sequence. The first asks you to think of a number between 1 and 10. The second displays a randomly generated number; the user can see whether his or her guess was accurate. (In future chapters, you will improve this game so that the user can enter a guess and the program can determine whether the user was correct. If you wish, you also can tell the user how far off the guess was, whether the guess was high or low, and provide a specific number of repeat attempts.) Save the file as RandomGuess.javaarrow_forwardThis needs to be done in Java! A palindrome is a sequence of characters that reads the same backward as forward. For example, each of the following five-digit integers is a palindrome: 12321, 55555, 4554, and 11611. Write an application that reads in a five-digit integer and determines whether it’s a palindrome. If the number is not five digits long, display an error message and allow the user to enter a new value. Algorithm: Create two variables number and digits Capture the 5 digit number. Check If the number is not 5 characters long, display a message Use: while (digits != 5) Use if else statements: if (number < 100000) Set digits to 5 if > 9999 If not display statement letting the user know to enter correct 5 digit number Separate each digit: int digit1 = number / 10000; int digit2 = number % 10000 / 1000; int digit4 = number % 10000 % 1000 % 100 / 10; int digit5 = number % 10000 % 1000 % 100…arrow_forward
- Lab10act1. Please help me code in python programming.arrow_forwardTask 5: ScanningMoney.java Write a program that reads User Input using the Scanner class. Your program should ask the user how many quarters, nickels, dimes, and pennies they have, then display the total amount in dollars. This can be done in main method. Expected Output The highlighted text denotes text that you type into the console yourself. It is not printed by the program. Due to floating point values being used your answer may have the trailing 1 or not. ----JGRASP exec: java ScanningMoney Quarters: 4 Dimes: 3 Nickels: 2 Pennies: 1 You have $1.4100000000000001 ----JGRASP: operation complete.arrow_forwarduse java : write an application that reads English-Language phrase and encodes it into morse code. also write an application that reads a phrase in morse code and converts it into the English-Language equivalent . Use one blank between each Morse-code letter and three blanks between each Morse-coded word.arrow_forward
- Create a Java application which will take an infix algebraic expression as an input from user. It will check that whether it is a valid expression or not. Then It will be converted into postfix expression, and at the end it will be evaluated and print the result of the expression. For example:if input is: (3+5)*(7output: it is invalid.If input is: (3+5)*7 , displayPostfix form: 35+7*Answer: 56.arrow_forwardPlease solve this using java Write an application that allows a user to enter the names and birth dates of up to 10 friends. Continue to prompt the user for names and birth-dates until the user enters the sentinel value “ZZZ” for a name or has entered 10 names, whichever comes first. When the user is finished entering names, produce a count of how many names were entered, and then display the names. In a loop, continuously ask the user to type one of the names and display the corresponding birth-date or an error message if the name has not been previously entered. The loop continues until the user enters “ZZZ” for a name.arrow_forwardWrite an application that allows a user to enter the names and birthdays of up to 10 friends. Continue to prompt the user for names and birthdates until the user enters the sentinel value “ZZZ” for a name or has entered 10 names, whichever comes first. When the user is finished entering names, produce a count of how many names were entered, and then display the names. In a loop, continuously ask the user to type one of the names and display the corresponding birthdate or an error message if the name has not been previously entered. The loop continues until the user enters “ZZZ” for a name. Save the file as BirthdayReminder.java.arrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,