Design the logic and write the rest of the program

Assignment Help JAVA Programming
Reference no: EM13940315

First Problem

I need help answering the following questions.  I tried to do this in Java but I couldn't get it to execute.

intnumValue = 10;
int answer = 0;
switch(numValue)
{

case 5:   answer += 5;
case 10:  answer += 10;
case 15:  answer += 15;
break;
case 20:  answer += 20;
case 25:  answer += 25;
default:  answer = 0;
break; 

System.out.println("Answer: " + answer);

  • What is the value of answer if the value of numValue is 10?
  • What is the value of answer if the value of numValue is 20?
  • What is the value of answer if the value of numValue is 5?
  • What is the value of answer if the value of numValue is 17?
  • Is the break statement in the default case needed? Explain?

Second Problem -

need assistance with the area highlighted in yellow.  Design the logic and write the rest of the program using a nested statement.  They are using JOptionPane.showInputDialog.

Productivity Score           Bonus

  <= 30                          $25

   31-79                         $50

   80-199                      $100

    >=200                      $200

// EmployeeBonus.java - This program calculates an employee's productivity bonus.

 

importjavax.swing.*;

publicclassEmployeeBonus
{
publicstaticvoid main(String args[])
   {
// Declare and initialize variables here.
      String employeeName;
doublenumTransactions;
      String transactString;
doublenumShifts;
      String shiftString;
doubledollarValue;
      String dollarString;
double score;
double bonus;
finaldouble BONUS_1 = 25.00;
finaldouble BONUS_2 = 50.00;
finaldouble BONUS_3 = 100.00;
finaldouble BONUS_4 = 200.00;

// This is the work done in the housekeeping() method
employeeName = JOptionPane.showInputDialog("Enter employee's name: ");
shiftString = JOptionPane.showInputDialog("Enter number of shifts: ");
transactString = JOptionPane.showInputDialog("Enter number of transactions: ");
dollarString = JOptionPane.showInputDialog("Enter transactions dollar value: ");

numShifts = Double.parseDouble(shiftString);
numTransactions = Double.parseDouble(transactString);
dollarValue = Double.parseDouble(dollarString);

// This is the work done in the detailLoop() method

// Write your code here (Design the logic and write the rest of the program
//using a nested if statement.

// This is the work done in the endOfJob() method

// Output. 
System.out.println("Employee Name: " + employeeName);
System.out.println("Employee Bonus: $" + bonus);

System.exit(0);
   }
}

Reference no: EM13940315

Questions Cloud

The structure of probation effectively reintegrates : 1.Take a position on whether or not the structure of probation effectively reintegrates the offender back into society while avoiding the stigma of incarceration. Provide a rationale for your response.
What are the firm major strengths and weaknesses : Use the extended DuPont equation to provide a summary and overview of company's financial condition projected for 2014. What are the firm's major strengths and weaknesses
Castles in the sand generates a rate of return : What happens to the P/E ratio if the plow back ratio is reduced to .20? Show that if plow back equals zero, the earnings-price ratio, E/P, falls to the expected rate of return on the stock.
Description of the organizations key knowledge areas : Description of the organization's key knowledge areas - description of the organization's use of IT-based tools for managing knowledge
Design the logic and write the rest of the program : Design the logic and write the rest of the program using a nested statement.  They are using JOptionPane.showInputDialog.
Dividends are expected to grow at a rate : Synovec Co. is growing quickly. Dividends are expected to grow at a rate of 20 percent for the next three years, with the growth rate falling off to a constant 4 percent thereafter. If the required return is 10 percent, and the company just paid a di..
Cognitive moral development and locus of control : Evaluate yourself in terms of cognitive moral development and locus of control, eithical decision-making style, Moral disengagement, and Machiavellianism what does this tell you about your own ethical decision making?
What will bid be for job k if the sequential method is used : Allocate the service costs to the producing departments by using the sequential method. What will the bid be for Job K if the sequential method is used?
Organisational risk management plan-legal requirements : Risk analyses are undertaken in accordance with the organisational risk management plan and legal requirements and participants in the performance management and review process are trained

Reviews

Write a Review

JAVA Programming Questions & Answers

  Write the code1 one argument used to justify the fact that

write the code1. one argument used to justify the fact that the stack data structure in the standard library does not

  Implementation of encryption and steganography in java

This is a project report showing the essential details and coding structures related with the implementation of encryption techniques and steganography in JAVA.

  Write a java program that calculates and displays the result

Write a Java program that calculates and displays the results of addition, subtraction, multiplication, division, modulus, bitwise &, or bitwise | operation on two integer values input by the user.

  Instantiate a circle by giving its radius and use

Write a class Circle.java from which we can instantiate a circle by giving its radius and use it as is shown in the following program. 1 import java.util.Scanner; 2 public class Circles {

  How do the two implementations differ

Give an example of a program that uses the non-generic version of a class from the Java collection framework and the equivalent program that uses the generic version.How do the two implementations differ?

  Good idea to test a general class with a driver program

Question 1: Why is it a good idea to test a general class with a driver program before trying to use it? Question 2: What is the difference between black box and glass box debugging?

  Write a program that lets the user click on the panel

Write a program that lets the user click on the panel to dynamically create points. Initially, the panel is empty. When a panel has two or more points, highlight the pair of closest points. Whenever a new point is created, a new pair of closest po..

  Java program on roulette

Consider the game of Roulette, where players bet on the numbers 1 through 36 (as well as 0 and 00). A large wheel consisting all 38 of these numbers and a small ball is spun until the ball lands on one of these numbers at random.

  Write java program to reverse contents of original array

Write down the Java program method named reversal which returns the new array which is a reversal of original array. Use [5.0, 4.4, 1.9, 2.9, 3.4, 3.5] to test method.

  Create a class representing a student

Create a second class that instantiates the first class with information about yourself. In the second class, create a class method that displays your name and GPA.

  Create a website

The preplanning design consists of a document that defines the element specifically requested by the client and indicates where these features will be located on the Website

  Complete the design details of the classes in the package

The design phase of the SRS project is in full swing and every developer on the team is assigned a group of packages to work on and to complete the design details of the classes in the package. To help speed up the design process, you-as the softw..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd