that is to be incremented three times as long as the Boolean is false. If the Boolean is true, ti increment only twice. There is a single exception to this: when the Boolean is true and the in is -1000. Then, don't increment. Just return the value -1000.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

The question and framework for the code is shown in the pictures

 

One integer and one Boolean value will be sent to your method. The integer is a counter value
that is to be incremented three times as long as the Boolean is false. If the Boolean is true, then
increment only twice. There is a single exception to this: when the Boolean is true and the integer
is -1000. Then, don't increment. Just return the value - 1000.
1. If the Boolean is false and a value of 5 is passed to your method, then return a value of 8.
o Likewise, if it's false, and any other integer is passed, it will be incrmeented three times.
2. If the Boolean is true and the a value of 3 is passed to your method, then return a value of 5.
o Likewise, if it's true and any other integer is passed, it will be incremented twice.
3. If a Boolean is true and the value passed to the method is -1000, then exit and return -1000.
Transcribed Image Text:One integer and one Boolean value will be sent to your method. The integer is a counter value that is to be incremented three times as long as the Boolean is false. If the Boolean is true, then increment only twice. There is a single exception to this: when the Boolean is true and the integer is -1000. Then, don't increment. Just return the value - 1000. 1. If the Boolean is false and a value of 5 is passed to your method, then return a value of 8. o Likewise, if it's false, and any other integer is passed, it will be incrmeented three times. 2. If the Boolean is true and the a value of 3 is passed to your method, then return a value of 5. o Likewise, if it's true and any other integer is passed, it will be incremented twice. 3. If a Boolean is true and the value passed to the method is -1000, then exit and return -1000.
public class prelabb{
// this is a constant available to all nethods in the class prelabD.
private static final int BREAK_VALUE_1 = ; // increment twice
private static final int BREAK_VALUE_2 = ; // increment three times.
private static final int BREAK_VALUE_3 = ; 7/ naybe that -1800 goes here?
// static context required for testing...
public static int myMethod(int testvalue, Boolean MyBoolean){
int myReturnedInt = testvalue;
while(true)
if(MyBoolean
== )
if ()
break;
}
else
//
the loop.
{
nyReturnedInt++;
if ()
{
// exit the loop.
else
{
nyReturnedInt++;
if ( )
{
// exit the loop.
return myReturnedInt;
Transcribed Image Text:public class prelabb{ // this is a constant available to all nethods in the class prelabD. private static final int BREAK_VALUE_1 = ; // increment twice private static final int BREAK_VALUE_2 = ; // increment three times. private static final int BREAK_VALUE_3 = ; 7/ naybe that -1800 goes here? // static context required for testing... public static int myMethod(int testvalue, Boolean MyBoolean){ int myReturnedInt = testvalue; while(true) if(MyBoolean == ) if () break; } else // the loop. { nyReturnedInt++; if () { // exit the loop. else { nyReturnedInt++; if ( ) { // exit the loop. return myReturnedInt;
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Random Class and its operations
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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education