Answer:
Check the explanation
Explanation:
// include the necessary packages
import java.io.*;
import java.util.*;
// Declare a class
public class DataReader
{
// Start the main method.
public static void main(String[] args)
{
// create the object of scanner class.
Scanner scan = new Scanner(System.in);
// Declare variables.
boolean done = false;
boolean done1 = false;
float sum = 0;
double v;
int count = 0;
// start the while loop
while (!done1)
{
// start the do while loop
do
{
// prompt the user to enter the value.
System.out.println("Value:");
// start the try block
try
{
// input number
v = scan.nextDouble();
// calculate the sum
sum = (float) (sum + v);
}
// start the catch block
catch (Exception nfe)
{
// input a character variable(\n)
String ch = scan.nextLine();
// display the statement.
System.out.println(
"Input Error. Try again.");
// count the value.
count++;
break;
}
}
// end do while loop
while (!done);
// Check whether the value of count
// greater than 2 or not.
if (count >= 2)
{
// display the statement on console.
System.out.println("Sum: " + sum);
done1 = true;
}
}
}
}
Sample Output:
Value:
12
Value:
12
Value:
ten
Input Error. Try again.
Value:
5
Value:
nine
Input Error. Try again.
Sum: 29.0
Answer:
Margin is the correct answer to the given question .
Explanation:
The main objective of the margin is to setting the white space that are showing up at the top , bottom, left and the right corners of the file or the document .
Following are steps to setting the white space that are showing up at the top , bottom, left and the right corners of the file or the document
- Firstly click on the page layout options .
- After that click on the margin tab .In this tab you will given the the top, bottom, left, and right margin according to your need
- Finally click on ok to finish them .
Answer:
input-year taken 2020
2020 is divisible by 2
output- 2020 is a leap year
Answer:
It gives the power of setting values and using them anywhere within the coding project without declaring them again.
Explanation:
What is a variable?
A variable is a name that a programmer gives to locations in a computer memory where values are stored and they need to be declared before usage.
Declaring a variable means that its data type must be defined and initial value set and creating your own variables gives the power of being able to set the variable once and use anywhere in the coding project without declaring it again.