# MyprogrammingLab 3.2, 3.3, 3.4

 Write a literal representing the false value. false Write a literal representing the true value. true Declare a variable isACustomer suitable for representing a true or false value. boolean isACustomer; Declare a variable hasPassedTest, and initialize it to true. boolean hasPassedTest = true; Given an int variable grossPay, write an expression that evaluates to true if and only if the value of grossPay is less than 10,000. grossPay < 10000 Write an expression that evaluates to true if and only if the integer x is greater than the integer y. x>y Write an expression that evaluates to true if and only if the value of the integer variable x is equal to zero. x==0 Write an expression that evaluates to true if and only if the variables profits and losses are exactly equal. profits==losses Write an expression that evaluates to true if the value of index is greater than the value of lastIndex. index>lastIndex Working overtime is defined as having worked more than 40 hours during the week. Given the variable hoursWorked, write an expression that evaluates to true if the employee worked overtime. hoursWorked > 40 Write an expression that evaluates to true if the value x is greater than or equal to y. x >= y Given the variables numberOfMen and numberOfWomen, write an expression that evaluates to true if the number of men is greater than or equal to the number of women. numberOfMen >= numberOfWomen Given a double variable called average, write an expression that is true if and only if the variable's value is less than 60.0. average < 60.0 Given the char variable c, write an expression that is true if and only if the value of c is not the space character. c != ' ' Assume that c is a char variable has been declared and already given a value. Write an expression whose value is true if and only if c is a newline character. (c == '\n') Assume that c is a char variable has been declared and already given a value. Write an expression whose value is true if and only if c is a space character. (c == ' ') Assume that c is a char variable has been declared and already given a value. Write an expression whose value is true if and only if c is a tab character. (c == '\t') Write an expression that evaluates to true if the integer variable x contains an even value, and false if it contains an odd value. (x%2 == 0) Write an expression that evaluates to true if the value of the integer variable numberOfPrizes is divisible (with no remainder) by the integer variable numberOfParticipants. Assume that numberOfParticipants is not zero. numberOfPrizes % numberOfParticipants == 0 Write an expression that evaluates to true if the value of the integer variable widthOfBox is not divisible by the value of the integer variable widthOfBook. Assume that widthOfBook is not zero. ("Not divisible" means has a remainder.) widthOfBox % widthOfBook !=0 Write a conditional that assigns 10,000 to the variable bonus if the value of the variable goodsSold is greater than 500,000. if(goodsSold > 500000) bonus = 10000; Write a conditional that decreases the variable shelfLife by 4 if the variable outsideTemperature is greater than 90. if (outsideTemperature > 90) shelfLife -= 4; Assume that the variables gpa, deansList and studentName, have been declared and initialized. Write a statement that adds 1 to deansList and prints studentName to standard out if gpa exceeds 3.5. if(gpa > 3.5){ deansList = deansList + 1; System.out.println(studentName); } Write an if/else statement that compares the variable age with 65, adds 1 to the variable seniorCitizens if age is greater than or equal to 65, and adds 1 to the variable nonSeniors otherwise. if (age >= 65) { seniorCitizens++; } else { nonSeniors++; }; Write an if/else statement that compares the value of the variables soldYesterday and soldToday, and based upon that comparison assigns salesTrend the value -1 or 1. -1 represents the case where soldYesterday is greater than soldToday; 1 represents the case where soldYesterday is not greater than soldToday. if (soldYesterday>soldToday) salesTrend=-1; else salesTrend=1; NOTE: in mathematics, the square root of a negative number is not real; in Java therefore, passing such a value to the square root function returns a value known as NaN (not-a-number). Given a double variable named areaOfSquare write the necessary code to read in a value, the area of some square, into areaOfSquare and print out the length of the side of that square. HOWEVER: if any value read in is not valid input, just print the message "INVALID". ASSUME the availability of a variable, stdin, that references a Scanner object associated with standard input. areaOfSquare = stdin.nextDouble(); if (areaOfSquare < 0) System.out.print("INVALID"); else System.out.print(Math.sqrt(areaOfSquare)); NOTE: in mathematics, division by zero is undefined. So, in Java, division by zero is always an error. Given a int variable named callsReceived and another int variable named operatorsOnCall write the necessary code to read values into callsReceived and operatorsOnCall and print out the number of calls received per operator (integer division with truncation will do). HOWEVER: if any value read in is not valid input, just print the message "INVALID". ASSUME the availability of a variable, stdin, that references a Scanner object associated with standard input. callsReceived = stdin.nextInt(); operatorsOnCall = stdin.nextInt(); if (operatorsOnCall == 0) System.out.println("INVALID"); else System.out.println(callsReceived/operatorsOnCall);
MyprogrammingLab 3.2, 3.3, 3.4 - Subjecto.com

# MyprogrammingLab 3.2, 3.3, 3.4

Total word count: 892
Pages: 3

### Calculate the Price

- -
275 words
Looking for Expert Opinion?
Let us have a look at your work and suggest how to improve it!
 Write a literal representing the false value. false Write a literal representing the true value. true Declare a variable isACustomer suitable for representing a true or false value. boolean isACustomer; Declare a variable hasPassedTest, and initialize it to true. boolean hasPassedTest = true; Given an int variable grossPay, write an expression that evaluates to true if and only if the value of grossPay is less than 10,000. grossPay < 10000 Write an expression that evaluates to true if and only if the integer x is greater than the integer y. x>y Write an expression that evaluates to true if and only if the value of the integer variable x is equal to zero. x==0 Write an expression that evaluates to true if and only if the variables profits and losses are exactly equal. profits==losses Write an expression that evaluates to true if the value of index is greater than the value of lastIndex. index>lastIndex Working overtime is defined as having worked more than 40 hours during the week. Given the variable hoursWorked, write an expression that evaluates to true if the employee worked overtime. hoursWorked > 40 Write an expression that evaluates to true if the value x is greater than or equal to y. x >= y Given the variables numberOfMen and numberOfWomen, write an expression that evaluates to true if the number of men is greater than or equal to the number of women. numberOfMen >= numberOfWomen Given a double variable called average, write an expression that is true if and only if the variable’s value is less than 60.0. average < 60.0 Given the char variable c, write an expression that is true if and only if the value of c is not the space character. c != ‘ ‘ Assume that c is a char variable has been declared and already given a value. Write an expression whose value is true if and only if c is a newline character. (c == ‘\n’) Assume that c is a char variable has been declared and already given a value. Write an expression whose value is true if and only if c is a space character. (c == ‘ ‘) Assume that c is a char variable has been declared and already given a value. Write an expression whose value is true if and only if c is a tab character. (c == ‘\t’) Write an expression that evaluates to true if the integer variable x contains an even value, and false if it contains an odd value. (x%2 == 0) Write an expression that evaluates to true if the value of the integer variable numberOfPrizes is divisible (with no remainder) by the integer variable numberOfParticipants. Assume that numberOfParticipants is not zero. numberOfPrizes % numberOfParticipants == 0 Write an expression that evaluates to true if the value of the integer variable widthOfBox is not divisible by the value of the integer variable widthOfBook. Assume that widthOfBook is not zero. ("Not divisible" means has a remainder.) widthOfBox % widthOfBook !=0 Write a conditional that assigns 10,000 to the variable bonus if the value of the variable goodsSold is greater than 500,000. if(goodsSold > 500000) bonus = 10000; Write a conditional that decreases the variable shelfLife by 4 if the variable outsideTemperature is greater than 90. if (outsideTemperature > 90) shelfLife -= 4; Assume that the variables gpa, deansList and studentName, have been declared and initialized. Write a statement that adds 1 to deansList and prints studentName to standard out if gpa exceeds 3.5. if(gpa > 3.5){ deansList = deansList + 1; System.out.println(studentName); } Write an if/else statement that compares the variable age with 65, adds 1 to the variable seniorCitizens if age is greater than or equal to 65, and adds 1 to the variable nonSeniors otherwise. if (age >= 65) { seniorCitizens++; } else { nonSeniors++; }; Write an if/else statement that compares the value of the variables soldYesterday and soldToday, and based upon that comparison assigns salesTrend the value -1 or 1. -1 represents the case where soldYesterday is greater than soldToday; 1 represents the case where soldYesterday is not greater than soldToday. if (soldYesterday>soldToday) salesTrend=-1; else salesTrend=1; NOTE: in mathematics, the square root of a negative number is not real; in Java therefore, passing such a value to the square root function returns a value known as NaN (not-a-number). Given a double variable named areaOfSquare write the necessary code to read in a value, the area of some square, into areaOfSquare and print out the length of the side of that square. HOWEVER: if any value read in is not valid input, just print the message "INVALID". ASSUME the availability of a variable, stdin, that references a Scanner object associated with standard input. areaOfSquare = stdin.nextDouble(); if (areaOfSquare < 0) System.out.print("INVALID"); else System.out.print(Math.sqrt(areaOfSquare)); NOTE: in mathematics, division by zero is undefined. So, in Java, division by zero is always an error. Given a int variable named callsReceived and another int variable named operatorsOnCall write the necessary code to read values into callsReceived and operatorsOnCall and print out the number of calls received per operator (integer division with truncation will do). HOWEVER: if any value read in is not valid input, just print the message "INVALID". ASSUME the availability of a variable, stdin, that references a Scanner object associated with standard input. callsReceived = stdin.nextInt(); operatorsOnCall = stdin.nextInt(); if (operatorsOnCall == 0) System.out.println("INVALID"); else System.out.println(callsReceived/operatorsOnCall);

### More flashcards like this

#### NCLEX 10000 Integumentary Disorders

When assessing a client with partial-thickness burns over 60% of the body, which finding should the nurse report immediately? a) ...

#### NCLEX 300-NEURO

A client with amyotrophic lateral sclerosis (ALS) tells the nurse, "Sometimes I feel so frustrated. I can’t do anything without ...

#### NASM Flashcards

Which of the following is the process of getting oxygen from the environment to the tissues of the body? Diffusion ...

## Unfinished tasks keep piling up?

Let us complete them for you. Quickly and professionally.

Check Price 