Examlex
What will be the final output of the following code snippet when a user enters input values in the order 10, 20, 30, 40, 50, and -1? public static void main(String[] args)
{
Double sum = 0;
Int count = 0;
Double salary = 0;
Double average = 0;
Scanner reader = new Scanner(System.in) ;
System.out.println("Enter salaries (-1 to stop) : ") ;
While (salary != -1)
{
Salary = reader.nextInt() ;
If (salary != -1)
{
Sum = sum + salary;
Count++;
}
}
If (count > 0)
{
Average = sum / count;
System.out.println("The Average Salary: " + average) ;
}
Else
{
System.out.println ("No data!") ;
}
Return 0;
}
Foreign Hands
Refers to the involvement or ownership by individuals, companies, or governments from other countries.
American Dollars
refer to the currency of the United States, used as the primary form of money in the country and a major global reserve currency.
Domestic Inflation
The speed at which the overall price level of goods and services increases, leading to a decrease in the country's purchasing power.
Trade Deficits
A condition in which a nation's expenditures on imported goods and services surpass its earnings from exports, resulting in a trade deficit.
Q2: To use a class in another package
Q9: Suppose the class Message is partially defined
Q19: Which statement stores an integer value in
Q30: You are creating a Motorcycle class which
Q49: Suppose the class Value is partially defined
Q64: Which of the following statements is correct?<br>A)
Q71: We want to create a class that
Q82: ) Suppose you wish to process an
Q94: What will be printed by the statements
Q114: What should you check for when calculating