subject

Public class Question1
{
/* For this Exercise, you will be writing 8 different conditional expressions in order to solve a stated problem.
* There are five variables being passed as arguments to this method that you will use as part of your solution:
* An int variable with the identifier age
* A String variable with the identifier personName
* A Student variable with the identifier aStudent
* Two boolean variables with the identifiers a and b
*
* 1) Declare a boolean varaible with the identifier condition1 and assign it a value based on the following instructions:
* The value of a boolean expression involving the int variable age that evaluates to true based on the following conditions:
* The value of age is greater than or equal to 65.
*
* 2) Declare a boolean variable with the identifier condition2 and assign it a value based on the following instructions:
* The value of a boolean expression involving the String personName that evaluates to true based on the following conditions:
* The person's name comes before 'N' alphabetically (i. e., their names starts with A - M)
*
* 3) Declare a boolean variable with the identifier condition3 and assign it a value based on the following instructions:
* The result of a boolean expression involving the Student variable aStudent that evaluates to true based on the following conditions:
* The ID of the student contains no more than 7 digits in it.
*
* 4) Declare a boolean variable with the identifier condition4 and assign it a value based on the following instructions:
* The result of a boolean expression involving the int variable age that evaluates to true based on the following conditions:
* The value of age is in the range 18 to 24 inclusive.
*
* 5) Declare a boolean variable with the identifier condition5 and assign it a value based on the following instructions:
* The result of a boolean expression involving the String variable personName that evaluates to true based on the following conditions:
* The first or last letter in the String is an 'a' regardless of case (i. e., 'A' is also valid)
*
* 6) Declare a boolean variable with the identifier condition6 and assign it a value based on the following instructions:
* The result of a boolean expression involving the Student variable aStudent that evaluates to true based on the following conditions:
* The student's average grade for 3 exam scores is greater than 60.
*
* 7) Declare a boolean variable with the identifier condition7 and assign it a value based on the following instructions:
* The result of a boolean expression involving the Student variable aStudent and the String variable personName that evaluates to true based on the following conditions:
* The combined length of personName and the student's name is less than 10 characters or greater than 20 characters.
* You should exclude spaces from your calculation.
*
* 8) Declare a boolean variable with the identifier condition8 and assign it a value based on the following instructions:
* The result of a boolean expression involving the boolean variables a and b that models the logical implication ( -> ) operator. The expected behavior is:
* if both a and b are true, a -> b (i. e., a implies b) is true
* if a is true and b is false, a -> b (i. e., a implies b) is false
* if a is false, a -> b (i. e., a implies b) is true regardless of the value of b
*
* HINT: It is not necessary to use any if statements to complete this part of the Lab04 assignment.
* CHALLENGE: Make all of your solutions a single statement.
*/
public static boolean[] question1(int age, String personName, Student aStudent, boolean a, boolean b)
{
// Your code goes here:

// Necessary for unit tests. Do not modify.
return new boolean[] {condition1, condition2, condition3, condition4, condition5, condition6, condition7, condition8};
}

// Main method for testing code.
public static void main(String[] args)
{
// Modify these values to test your code
int age = 17;
String personName = "Betty";
Student aStudent = new Student();
boolean a = false;
boolean b = true;

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 01:30
Someone wishes to run the software on another computer system that runs an operating system that does not support the software what can he do
Answers: 3
question
Computers and Technology, 22.06.2019 13:00
We as humans write math expression in infix notation, e.g. 5 + 2 (the operators are written in-between the operands). in a computer’s language, however, it is preferred to have the operators on the right side of the operands, i.e. 5 2 +. for more complex expressions that include parenthesis and multiple operators, a compiler has to convert the expression into postfix first and then evaluate the resulting postfix.write a program that takes an “infix” expression as input, uses stacks to convert it into postfix expression, and finally evaluates it. it must support the following operations: + - / * ^ % (example infix expression: (7 - 3) / (2 + 2)postfix expression: 7 3 - 2 2 + /result: 1guidelines: 1. you will need to use stacks in three placesa. one for the parenthesis check [char stack]b. one during infix to postfix [char stack]c. one during evaluation [int stack]for a and b above, you can use same array and same push, pop method as both ofthem are char. but for evaluation you have int stack and you might consider to createanother push pop method to handle it. maybe push_int, pop_int, etc. or find otherstrategy to utilize existing push pop method2. you can create a function for obtaining operator priority. that function should take anoperator as input and return its priority as an integer. this function will you a lot andreduce repeated code3. during evaluation you will need to convert char into integer. example for single digit: char c = '5'; int x = c - '0';
Answers: 2
question
Computers and Technology, 23.06.2019 06:00
How can a user delete a drawing object
Answers: 1
question
Computers and Technology, 23.06.2019 09:00
Which best compares appointments and events in outlook 2010appointments have a subject man, and events do notappointments have a specific date or range of dates, and events do notappointments have a start and end time of day, and events do notappointments have a location option, and events do not
Answers: 2
You know the right answer?
Public class Question1
{
/* For this Exercise, you will be writing 8 different conditi...
Questions
question
Mathematics, 06.04.2021 22:20