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

  Implement a sorting algorithm for inclusion in a package

Prepare a targeted plan in which you present your detailed strategies to recruit and select 20 Engineers to hire (full-time or part-time) within 8 months - Implement a sorting algorithm for inclusion in a package for a lucrative client.

  Write a program that prompts the user to enter an integer

Using && and || write a program that prompts the user to enter an integer and determine whether it is: Evenly divisible by 5 AND 6.

  Write a program in java to implement the adt binary tree

Write a program in Java to implement the ADT Binary Tree part of whose definition is given below. You are also to write a driver program that demonstrates the correctness of your implementation by way of taking a series of commands from a text fil..

  Write an isr and startup code for a system

Write an ISR and startup code for a system that lights up LED0 on the PSoC Eval1 board (assuming that a wire is connecting P1[0]) to show "Low Voltage" whenever there is a supply voltage monitor interrupt.

  Java program editing

Prompt the user for the student's score and put that value into an object

  Evaluate the rtas resource requirements

Design and implement a set of classes and interfaces and use them to evaluate the RTA's resource requirements.

  Write a program to register students for a college

Students have names, addresses and courses. Implement the interface class RegisterStudent. RegisterStudent has one method, public boolean register, which returns the boolean value of true or false if the student is successfully registered for the ..

  How are java source code files named

What is the purpose of the wait(), notify(), and notifyAll() methods? How are Java source code files named?

  Questions of java programming

Write a program that opens a .txt, reads the contents of the file line by line, and prints the content of each line. To do this, you should use look up how to use the Buffered Reader class1. Remember to use the try and catch statements to handle e..

  Create the working applet to compute tax

Write down a java applet. Your applet assits to find out how much federal tax we require to pay suppose the tax rate is 12%. Create and implement the working applet to compute tax.

  Determine the type of moped

Write a driver class called MopedRental. This class should perform the following: asks the user to enter the size of the moped, the day of the week and the number of hours rented, creates the Moped object, based on the size, and displays the input..

  Write a method called printlevel

Write a method called printLevel that takes an integer n as a parameter and that prints the values at level n from left to right. The values should be printed one per line.

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