Concept explainers
Write an if-else statement that outputs the word "Emergency" provided the value of the variable pressure is greater than 100 or the value of the variable temperature is greater than or equal to 212. Otherwise, the if-else statement should output the word "OK". The variables pressure and temperature are both of type int.
Want to see the full answer?
Check out a sample textbook solutionChapter 3 Solutions
Absolute Java (6th Edition)
Additional Engineering Textbook Solutions
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Elementary Surveying: An Introduction To Geomatics (15th Edition)
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
INTERNATIONAL EDITION---Engineering Mechanics: Statics, 14th edition (SI unit)
Starting Out With Visual Basic (8th Edition)
- Write aprogram using nestedif statements that perform the following test: If the variable employed is equal to 'Y' and if worklength is equal or greater than 5, then display the message "Your credit card application is accepted". However, if worklength is less than 5, then display the message "Please provide a guarantor". Otherwise, if the variable employed is equal to 'N', then display the message "Your credit card application is rejected". C.arrow_forwardWrite a multiway if-else statement that classifies the value of an int variable ninto one of the following categories and writes out an appropriate message:n < 0 or 0 ≤ n < 100 or n ≥ 100Hint: Remember that the Boolean expressions are checked in order.arrow_forwardWrite an if statement that will print "equal" if the variables first and second agree to seven significant digits and "not equal" otherwise. First and second are variables of type double.arrow_forward
- Write if-else if statements that will compare "price" variable with below values and output statements based on the conditions price>=500 : “Extremely Expensive” price>=300 : “Very Expensive” price>=100: “Reasonable price “arrow_forwardSuppose that sale and bonus are double variables. Write an if...else statement that assigns a value to bonus as follows: If sale is greater than $20,000, the value assigned to bonus is 0.10, that is 10%; If sale is greater than $10,000 and less than or equal to $20,000, the value assigned to bonus is 0.05, that is 5%; otherwise the value assigned to bonus is 0, that is 0%.arrow_forwarddo it fastarrow_forward
- 30. If originally x=4, what is the value of x after the evaluation of the expression: x+=x+3arrow_forwardThe following statement should determine if x is not greater than 20. What is wrong with it?arrow_forwardC++ Write a program that determine the bonus amount using a nested if-else statements . For hourly employees working more than 40 hours, a bonus of $500 is issued. If hourly employee has not worked more that 40 hours, issue a bonus of $100. For those non-hourly employees, issue a $300 bonus if they have been employed longer that 10 years; otherwise, issue a $ 200 bonus.arrow_forward
- Write an if-else statement that works like this: If the sales variable is greaterthan or equal-to 50,000, the commissionRate variable should be assigned the value 0.2. Otherwise, the commissionRate variable should be assigned the value 0.1.arrow_forwardWrite an if-else statement that works like this: If the sales variable is greater- than or equal-to 50,000, the commissionRate variable should be assigned the value 0.2. Otherwise, the commissionRate variable should be assigned the value 0.1.arrow_forwardAssume that d is a double variable. Write an if statement that assigns d to the int variable i if the value in d is not larger than the maximum value for an int. i (int) d; System.out.println(i); } Submit X Incorrect. Try again.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education