Question

Java programming For the following problem statement, would you include an if/else statement or a switch...

Java programming

For the following problem statement, would you include an if/else statement or a switch statement?   Explain your answer.  Be sure to address both types of statements in your answer. (You do not need to write the code.)                              [3 Points]
 
Write a program that determines the bonus that should be paid to employees.  Bonuses are determined based on the year’s production.   The bonus is $25 for 1000 units or fewer.  The bonus is $50 for 1001 to 3000 units.  The bonus is $100 for 3001 units or more.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

The problem statement says that the bonus is paid to employees based upon the year's production

For this problem statement, we use if/else statement because if/else is a conditional statement we specify the conditions

for this problem if production_units<=1000 then bonus=bonus+25(dollars) and if production_units <=10000 and >1000 then bonus=bonus+50(dollars)

for this statement, we cannot use a switch case because generally switch is a conditional statement which allows choosing the particular choice among the many given choices. For this statement, there are no multiple choices(cases) here the solution of this problem statement is to just checking the condition and adding the bonus to the employees there is no need for the switch case statement'

Add a comment
Know the answer?
Add Answer to:
Java programming For the following problem statement, would you include an if/else statement or a switch...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • C programming Rewrite the following code replacing the else-if construct with a switch statement. Make sure...

    C programming Rewrite the following code replacing the else-if construct with a switch statement. Make sure you test your code. Supplied code #include <stdio.h> int main(void) { char ch; int countA = 0; int countE = 0; int countI = 0; printf("Enter in a letter A, E, or I.\n"); scanf(" %c", &ch); //Replace the following block with your switch if(ch == 'E' || ch == 'e') countE++; else if(ch == 'A' || ch == 'a') countA++; else if(ch == 'I'...

  • Please write in C++ MEMO To: The Programming Staff From The Boss I need a program that will help me figure out who gets...

    Please write in C++ MEMO To: The Programming Staff From The Boss I need a program that will help me figure out who gets what for this year’s annual bonuses. Here are the conditions: Every employee gets a basic bonus of $1000. All the employees in department 2 get an additional $1000 bonus (above the basic bonus) unless they have more than five dependents. Any employee with more than five dependents gets a $5000 bonus. And no – you can’t...

  • // Lab Homework 12 // Using a switch statement to replace an if...else if...else if...else #include...

    // Lab Homework 12 // Using a switch statement to replace an if...else if...else if...else #include <iostream> #include <cctype> // for toupper() using namespace std; int main() {    /* Create a program that produces the Sample Output shown at the bottom.    You MUST:    - Output all of the lines show below in the Sample Output - spacing, spelling, punctuation, etc. must be exact matches    NOTE: There are THREE different runs of the program shown - do...

  • How would you write the following program using switch statements instead of if-else statements (in java)...

    How would you write the following program using switch statements instead of if-else statements (in java) import java.util.*; public class ATM { public static void main(String[] args) { Scanner input = new Scanner (System.in); double deposit, withdrawal; double balance = 6985.00; //The initial balance int transaction; System.out.println ("Welcome! Enter the number of your transaction."); System.out.println ("Withdraw cash: 1"); System.out.println ("Make a Deposit: 2"); System.out.println ("Check your balance: 3"); System.out.println ("Exit: 4"); System.out.println ("***************"); System.out.print ("Enter Your Transaction Number "); transaction...

  • Pick a switch statement from the reading. Put it into a main() Java program and make...

    Pick a switch statement from the reading. Put it into a main() Java program and make it work. Attach the .java file and copyAndPaste the output into the WriteSubmissionBox The switch Statement S1.51 Multiway if-else statements can become unwieldy when you must choose from among many possible courses of action. If the choice is based on the value of an integer or character expres- sion, the switch statement can make your code easier to read. The switch statement begins with...

  • java programming: Convert the following PSEUDOCODE into a java program. For this problem I'm giving you...

    java programming: Convert the following PSEUDOCODE into a java program. For this problem I'm giving you the pseudocode and you are writing the program, in later problems you will write both the pseudocode and the java program. This means for this program pseudocode is NOT required. Pseudocode to convert to a java program: Create variables: speed, time and distance Store 20 in the variable speed Store 10 in the variable time Multiply speed * time and store the result in...

  • java programming: Convert the following PSEUDOCODE into a java program. For this problem I'm giving you...

    java programming: Convert the following PSEUDOCODE into a java program. For this problem I'm giving you the pseudocode and you are writing the program, in later problems you will write both the pseudocode and the java program. This means pseudocode is NOT required for this program. Pseudocode to convert to a java program: Create variables: force, area, and pressure Store 172.5 in the variable force Store 27.5 in the variable area Divide force by area and store the result in...

  • I am learning programming in JAVA. Please help me with this programming assignment. Your lab assignment...

    I am learning programming in JAVA. Please help me with this programming assignment. Your lab assignment this week is to build a little math program to help kids practice their addition and subtraction. You will create a menu and have the kid select what kind of math problem they want to solve. Once the kid selects what kind of problem. Randomly generate two numbers, display the problem and allow the kid to enter the answer. If the answer is correct....

  • Write the code in java. Just a simple code with no While loop. If-else statement is...

    Write the code in java. Just a simple code with no While loop. If-else statement is permitted. Thanks. Game rule: paper beats rock; rock beats scissor and scissor beats paper. Paper-0; rock-1; sissor 2 Computer generates random number 0-2 int computerGuess; computerGuess (int) (Math.random ()*3) You are asked to enter value 0-2 Use at least one switch statement DETERMINE WHO WINS OR TIE BECAUSE BOTH PICKED SAME VALUE PRINT-what computer picked, what you picked and who won "Computer picked rock,...

  • You will write Java programs in Eclipse to solve these word problems Read these instructions on...

    You will write Java programs in Eclipse to solve these word problems Read these instructions on how to name and submit the Java files. Please make sure your program compiles before you submit it. Make sure you name your Java file and class the same (otherwise it will not compile). For example, the class names are case-sensitive 1. will be in a file called CompareNames.java; remember, the Do not create a package. You can tell if your file is in...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT