Absolute Java (6th Edition)
6th Edition
ISBN: 9780134041674
Author: Walter Savitch, Kenrick Mock
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 3, Problem 4STE
Suppose salary and deductions are variables of type double that have been given values. Write an if-else statement that outputs the word "Crazy" if salary is less than deductions; otherwise, it should output "OK" and set the variable net equal to salary minus deductions.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Suppose salary and deductions are variables of type double that have beengiven values. Write an if-else statement that outputs the word "Crazy" ifsalary is less than deductions; otherwise, it should output "OK" and set thevariable net equal to salary minus deductions.
C++
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.
Suppose savings and expenses are variables of type double that have beengiven values. Write an if-else statement that outputs the word "Solvent",decreases the value of savings by the value of expenses, and sets the value ofexpenses to zero, provided that savings is larger than expenses. If, however,savings is less than or equal to expenses, the if-else statement should simplyoutput the word "Bankrupt" without changing the value of any variables.
Chapter 3 Solutions
Absolute Java (6th Edition)
Ch. 3 - Write an if-else statement that outputs the word...Ch. 3 - Suppose savings and expenses are variables of type...Ch. 3 - Suppose number is a variable of type int. Write an...Ch. 3 - Suppose salary and deductions are variables of...Ch. 3 - What output will be produced by the following...Ch. 3 - What would be the output in Self-Test Exercise 5...Ch. 3 - What would be the output in Self-Test Exercise 5...Ch. 3 - Write a multiway if-else statement that classifies...Ch. 3 - Prob. 9STECh. 3 - Prob. 10STE
Ch. 3 - Prob. 11STECh. 3 - Prob. 12STECh. 3 - Prob. 13STECh. 3 - Suppose are two variables that have been given...Ch. 3 - Prob. 15STECh. 3 - Assume that nextword is a String variable that has...Ch. 3 - Write an if-else statement that outputs the word...Ch. 3 - Write an if-else statement that outputs the word...Ch. 3 - Determine the value, true or false, of each of the...Ch. 3 - Does the following sequence produce a division by...Ch. 3 - Prob. 21STECh. 3 - Prob. 22STECh. 3 - What output would be produced in Self-Test...Ch. 3 - What is the output produced by the following?
Ch. 3 - What output would be produced in Self-Test...Ch. 3 - Prob. 26STECh. 3 - What is the most important difference between a...Ch. 3 - Prob. 28STECh. 3 - Prob. 29STECh. 3 - What is the output of the following?
Ch. 3 - Rewrite the following for statement as a while...Ch. 3 - What is the output of the following loop? Identify...Ch. 3 - What is the output of the following loop? Comment...Ch. 3 - Prob. 34STECh. 3 - For each of the following situations, tell which...Ch. 3 - What is the output of the following?
Ch. 3 - What is the output of the following?
Ch. 3 - What is the output produced by the following?...Ch. 3 - What is the output produced by the following?...Ch. 3 - Fix the bug in the code in the earlier subsection...Ch. 3 - Add some suitable output statements to the...Ch. 3 - What is the bug in the following code? What do you...Ch. 3 - Prob. 43STECh. 3 - What numbers could be generated by...Ch. 3 - What numbers could be generated by...Ch. 3 - Use the method Math. random to generate a random...Ch. 3 - (This is a version of Programming Project 2.1 from...Ch. 3 - A designer is trying to create a new pattern of...Ch. 3 - Weight is defined as the gravitational force...Ch. 3 - It is difficult to make a budget that spans...Ch. 3 - You have just purchased a stereo system that cost ...Ch. 3 - The Fibonacci numbers Fn are defined as follows:...Ch. 3 - An Armstrong number is an n-digit number that...Ch. 3 - In a certain code language, numerals are each...Ch. 3 - Write a program that calculates the total grade...Ch. 3 - The game of Pig is a simple two-player dice game...Ch. 3 - You have three identical prizes to give away and a...Ch. 3 - Redo or do for the first time Programming Project...Ch. 3 - The file words. txt on the hook's website contains...Ch. 3 - The file words. txt on the book's website contains...Ch. 3 - This problem is based on a "Nifty Assignment" by...Ch. 3 - Prob. 16PP
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
In each case, explain how to find the resultant internal loading acting on the cross section at point A. Draw a...
Mechanics of Materials (10th Edition)
A file that contains a Flash animation uses the __________ file extension. a. .class b. .swf c. .mp3 d. .flash
Web Development and Design Foundations with HTML5 (8th Edition)
The variable a starts with the value 10. The variable b starts with the value 2. The variable c starts with the...
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
What will the following pseudocode program display? Module main() Declare Integer x = 1 Declare Real y = 3.4 Di...
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Comprehension Check 8-13
A 5-gallon [gal] container holds 35 grams [g] of nitrogen (formula: N2, molecular weig...
Thinking Like an Engineer: An Active Learning Approach (4th Edition)
The current source in the circuit shown generates the current pulse
Find (a) v (0); (b) the instant of time gr...
Electric Circuits. (11th Edition)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Puma Filling Station sells gasoline and has a car wash. Fees for the car wash are K40.00 with a gasoline purchase of K200.00 or more and K70.00 otherwise. Three kinds of gasoline are available: regular at K16.25, unleaded at K 17.63, and super unleaded at K 19.50 per litter. You are required to write a program that prints a statement for a customer. Input consists of number of litters purchased, kind of gasoline purchased (R, U, S, or for no purchase, N), and car wash desired (Y or N). Develop a Pseudocode and a structure chart for the service station problem.arrow_forwardSuppose number is a variable of type int. Write an if-else statement thatoutputs the word "Positive" if the value of the variable number is greater than0 and outputs the words "Not positive" if the value of number is less than orequal to 0.arrow_forwardWrite a if-elif-else statement that distinguishes between a negative number or 0, a number between 0 and 50, and a number greater than or equal 50 by printing one of these three statements: {"It's negative or zero", "It's between 0 and 50", "It's greater than or equal to 50"}.arrow_forward
- Write out an IF-THEN-ELSE statement for the following conditions: 1. A person has credit card points and if the number of points entered > 4,999 then output “Enough points for Selection” otherwise output “Not Enough points for Selection” using Variable Points Available. 4. A customer is buying a car for $20,000 and wants to upgrade the stereo speakers for an additional $100. However, if the customer gets the extended stereo package for $250 which includes the upgraded speakers, XM radio, and upgraded visual display. Use variables CarPrice, UpgradedSpeakers and ExtendedStereo for the IF statement. Show the calculation for the total cost of the car depending on options selected.arrow_forwardSuppose salary and bonus are variables of type double. Write an if-else statement that displays the word OK provided that either salary is greater than or equal to MIN_SALARY or bonus is greater than or equal to MIN_ BONUS. Otherwise, it should display Toolow. MIN_SALARY and MIN_BONUS are named constants.arrow_forwardWrite an if-else statement that outputs the word “Emergency” provided the valueof the variable pressure is greater than 100 or the value of the variable temperatureis greater than or equal to 212. Otherwise, the if-else statement should outputthe word “OK”. The variables pressure and temperature are both of type int.arrow_forward
- Assume 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_forwardSuppose speed and visibility are variables of type int. Write an if statement that sets the variable speed equal to 25 and displays the word Caution, provided the value of speed is greater than 25 and the value of visibility is under 20. There is no else part.arrow_forwardWrite an if-else statement that outputs the word High if the value of the variable score is greater than 100 and Low if the value of score is at most 100. The variable score is of type int.arrow_forward
- 30. If originally x=4, what is the value of x after the evaluation of the expression: x+=x+3arrow_forwardPlease answer in matlab code.arrow_forwardIn admissions to military high schools, the age of the candidate should be between 13 - 17 (including lower and upper limit) and body mass index should be in the range of 18.50 - 24.99 (including lower and upper limit). (Body mass index is calculated by dividing weight by the square of height in meters. BMI = weight / height2). Write the JAVa program on the screen that will show whether the candidate will be admitted to military high school according to age, weight and height information entered on the keyboard.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Control Structure in Data Structure - Data Structures - Computer Science Class 12; Author: Ekeeda;https://www.youtube.com/watch?v=9FTw2pXLhv4;License: Standard YouTube License, CC-BY