1. Write a header with an appropriate return type and parameters. 2. Write the body with curly braces. 3. Declare a variable that matches the return type and initialize it with a placeholder value. 4. Return that variable.
Help me solve this problem
Multiple Choice & Some Date Fashion
When writing methods, always write the method skeleton first and make sure it compiles.
1. Write a header with an appropriate return type and parameters.
2. Write the body with curly braces.
3. Declare a variable that matches the return type and initialize it with a placeholder value.
4. Return that variable.
With practice, these
Practice these steps and then solve the DateFashion problem using sequential if statements along with the return statement. The idea is to get more practice with multi-branch logic. Therefore, don't use any of the binary Boolean operators like && or ||. You may use the Boolean not operator (!).
https://codecheck.it/files/1810031754ckr22amvk7fr6jtdrtqgrmqle


public class Datefashion{
// two parameters as specified you and date as int as values ranging from 0 to 10
//we are going to return as integer
public int dateFashion(int you, int date) {
int result=1; //this was no condition value
if(you>=8 || date>=8) //if any of them has style greater than or equal to 8
result=2; //set the result to 2
else if(you<=2 || date<=2) //if any of them has style lesser than or equal to 2
result=0; //set the result to 0
return result; //returnig result
}
}
Step by step
Solved in 3 steps with 1 images









