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

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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