import java.util.Scanner;
public class Squaring {
public static void main(String[] args) {
Scanner sc = new
Scanner(System.in);
int num = 0, k = 1, count =
0;
while (k == 1) {
k = 0;
System.out.println("Enter an integer greater than 1:");
if
(sc.hasNextInt()) {
num = sc.nextInt();
sc.nextLine();
if (num <= 1) {
System.out.println(num + " is
not greater than 1.");
k = 1;
}
} else {
System.out.println(sc.nextLine() + " is not a
valid input.");
k = 1;
}
}
double sq = num;
while (sq <= 1000000) {
sq = sq *
sq;
System.out.printf("%.0f\n",sq);
count +=
1;
}
System.out.println(num + " exceeded
1,000,000 after " + count + " squarings.");
sc.close();
}
}
in java Write an application called Squaring that will: • Prompt the user to enter an...
Write a complete program that will prompt the user for an integer You must keep asking the user until they give you a number that is greater than 700. Once they give a valid number, display all multiples of 7 from 7 to that number inclusively). You may assume the user will give you correct type of input, but your code must continue to prompt them until they give a number greater than 700.
Java Write a program that prompt the user to enter a decimal number representing the radius of a circle. If the number is greater or equal to zero, the program displays the area of the circle. Otherwise, the program displays “negative input”
Write a Java program that performs these operations Prompt the user to enter a low height in feet (an integer) Prompt the user to enter a high height in feet (an integer) Prompt the user to enter a low weight in pounds (an integer) Prompt the user to enter a high weight in pounds (an integer) Print a table of Body Mass Index (BMI) for the heights and weights entered, ranging from the low height to the high height (inclusive),...
(Java) Rewrite the following exercise to check the user inputs to be: Valid input and positive with using try-catch (and/or throw Exception ) ************************************************************************** Write a program to prompt the user for hours and rate per hour to compute gross pay. Calculate your pay computation to give the employee 1.5 times the hourly rate for hours worked above 40 hours. Your code should have at least the following methods to calculate the pay. (VOID and NON-STATIC) getInputs calculatePay printPay Create...
This is my python assignment You wrote a program to prompt the user for hours and rate per hour to compute gross pay. Also your pay computation to give the employee 1.5 times the hourly rate for hours worked above 40 hours. Enter Hours: 45 Enter Rate: 10 Pay: 475.0 (475 = 40 * 10 + 5 * 15) Rewrite your pay program using try and except so that your program handles non-numeric input gracefully. Enter Hours: 20 Enter Rate:...
Write a function to have a user enter some number of integers into an array. The integer values must be between -100 and +100 inclusive (+100 and -100 should be accepted as valid inputs). The integer array and the size of the array are passed into the function through parameters. Do not worry about includes. This is only a function, so there is no main routine. The function should fill the array with valid inputs. For invalid input values, inform...
Class name: "NextSquare" Prompt the user to enter an integer. display your name and the next integer larger than the input integer which is a perfect square. for example, if the input is 7, the output should be (your name plus) 9. I am looking for help with this and need the answer to be in JOptionPane with java language.
Using java prompt the user to enter an integer called n. Then scan in n values of type double.Find the middle value of the n numbers using a for loop. Assume the middle value is the ((n+1)/2) th number entered.
Write a program that will compute the user annual salary. Prompt the user the enter (1) the weekly salary. Store the information in a double variable. Prompt the user to enter the number of weeks worked in a year. Use an int variable for that. Write code that will compute the user's Annual salary. Gross salary is salary before any deductions are taken. Update the code and prompt the user to enter the federal tax rate and the state's tax...
Write a Java program to convert octal (integer) numbers into their decimal number equivalents (exactly the opposite of what you have done in Assignment 4). Make sure that you create a new Project and Java class file for this assignment. Your file should be named “Main.java”. You can read about octal-to-decimal number conversions on wikepedia Assignment 4 is at the bottom Objective Your program should prompt the user to enter a number of no greater than 8 digits. If the...