The Program Spec The following expressions assume that you have stored the sum of the numbers of your student ID into the variable myld, and the number of letters in your last (family) name into the variable nLet. No user input allowed. Rather, declare and assign these variables before computing the following values. First do the math on paper so you know what answers your program should generate (but not to hand this stage in). Write a program that computes and displays the following results. Your program should compute and display the results for the following expressions: expression 1: myld + nLet expression 2: myld -nLet expression 3: myld / 2 expression 4: myld % 2 expression 5: nLet+nLet* 2 expression 6: (myld)/(nLet + 1100) Write a Java program that computes and displays the results of these six expressions.
I need help with this lab please help me
I ask before but they provide the wrong code.
1. Declare and initialize two String variables:
- `familyName` with the value "Student"
- `studentID` with the value "12345678"
2. Declare and initialize two integer variables:
- `myId` with the value 36
- `nLet` with the value 7
3. Print the family name and student ID:
- Print "My family name is : " followed by the value of `familyName`
- Print "My student id is : " followed by the value of `studentID`
4. Print the values of `myId` and `nLet`:
- Print "myId is : " followed by the value of `myId`
- Print "nLet is : " followed by the value of `nLet`
5. Declare two variables to store arithmetic expression results:
- `intResult` for integer results
- `doubleResult` for double results
6. Calculate and print the results of the following expressions:
- Expression #1: `intResult` = `myId` + `nLet`
- Expression #2: `intResult` = `myId` - `nLet`
- Expression #3: `doubleResult` = `(double) myId / 2`
- Note: Casting to double to ensure accurate division
- Expression #4: `intResult` = `myId` % 2
- Expression #5: `intResult` = `nLet` + `nLet * 2`
- Expression #6: `doubleResult` = `(double) myId / (nLet + 1100)`
- Note: Casting to double to ensure accurate division
- Print the results of each expression with appropriate labels.
End of the algorithm.
Step by step
Solved in 5 steps with 2 images