Public class Question1
{
/* For this Exercise, you will be writing 8 different conditi...
Computers and Technology, 13.03.2020 23:46 samanthaurso1
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;
Answers: 1
Computers and Technology, 21.06.2019 22:50, prettybaby406
Explain why it is reasonable to assume that receiving 3 duplicate acks in tcp is an indication that the network is not currently congested.
Answers: 1
Computers and Technology, 22.06.2019 08:00, dramaqueenactr2040
Two technicians are discussing the common u-joint. technician a says its input and output speeds should be equal. technician b says that it normally has two yokes. which technician is correct?
Answers: 1
Computers and Technology, 23.06.2019 04:31, legendman27
Jennifer has to set up a network in a factory with an environment that has a lot of electrical interference. which cable would she prefer to use? jennifer would prefer to use because its metal sheath reduces interference.
Answers: 1
Mathematics, 26.06.2019 06:30
Mathematics, 26.06.2019 06:30
Mathematics, 26.06.2019 06:30
Mathematics, 26.06.2019 06:30
Mathematics, 26.06.2019 06:30