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.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

I need help with this lab please help me 

I ask before but they provide the wrong code.

Understand the Application
You will create two int variables, myld and nLet, into which you will store:
myld = The sum of the numbers in your College Generated student ID (GID). (This is the sum of an 7-digit number;
not to confuse it with your social security # or a password, which it is not).
• nLet The number of letters in your family (last) name.
In order to receive any credit for this assignment, these two values must match what I have for you on my class roster.
Your program will compute some values based on these two numbers, so that each student will have a unique output.
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:
myld + nLet
myld - nLet
myld / 2
myld % 2
expression1:
expression 2:
expression 3:
expression 4:
expression 5:
expression 6:
(myld) / (nLet + 1100)
Write a Java program that computes and displays the results of these six expressions.
nLet+nLet * 2
Transcribed Image Text:Understand the Application You will create two int variables, myld and nLet, into which you will store: myld = The sum of the numbers in your College Generated student ID (GID). (This is the sum of an 7-digit number; not to confuse it with your social security # or a password, which it is not). • nLet The number of letters in your family (last) name. In order to receive any credit for this assignment, these two values must match what I have for you on my class roster. Your program will compute some values based on these two numbers, so that each student will have a unique output. 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: myld + nLet myld - nLet myld / 2 myld % 2 expression1: expression 2: expression 3: expression 4: expression 5: expression 6: (myld) / (nLet + 1100) Write a Java program that computes and displays the results of these six expressions. nLet+nLet * 2
Your program display should look something like this (although the values will differ for each student):
My family name is: Student
My student id is: 12345678
myId is: 36
nLet is: 7
Expression #1 --> 43
Expression # 2 --> 29
Expression # 3 --> 18.0
Expression # 4 --> 0
Expression # 5 --> 21
Expression #6 --> 0.03252
Your exact output does not have to look like the example display above. For example, the part, "Expression #N --
>" can be the actual expression or some other wording. Note that the first two lines are output statements to display
the values you have assigned to the variable myld and numLet; the following lines are output from your program run.
This should all be done in one run of a single program, not several runs.
Here are some REQUIREMENTS:
1. Assign personal information (family name, student id) to String variables.
2. Hardcode values for myld and nLet.
3. Assign the arithmetic expression results to a variable. Use as few variables as possible.
4. Use a space around operators.
5. Perform the necessary data conversions to perform arithmetic operations.
6. As you can see in the sample run, the first thing your program needs to do is print out the values for your family
(last) name and your student ID.
7. Ensure that your solution is well organized. Providing comments to organize your source code is recommended.
8. Format floating point numbers to 1 decimal place for expression 3 and to 5 decimal places for expression 6.
9. Title your program filename to read ArithYourLastName (e.g. for the example run provided the class name would be
ArithStudent.java).
.O. Only one run, please, which means you must produce all six answers in your program in a single source file.
.1. Expressions #1, #2 #4 and #5 should use ordinary int arithmetic, which means using the int variables without any
special tools. However, expressions #3 and #6 are meant to display the double accuracy that the divisions will
produce, You should take appropriate action to do that.
.2. Use as few variables as possible. You can, for example, use one intResult variable for the four int expressions and a
second doubleResult variable for the two double expressions. However, not to use six separate result variables.
Transcribed Image Text:Your program display should look something like this (although the values will differ for each student): My family name is: Student My student id is: 12345678 myId is: 36 nLet is: 7 Expression #1 --> 43 Expression # 2 --> 29 Expression # 3 --> 18.0 Expression # 4 --> 0 Expression # 5 --> 21 Expression #6 --> 0.03252 Your exact output does not have to look like the example display above. For example, the part, "Expression #N -- >" can be the actual expression or some other wording. Note that the first two lines are output statements to display the values you have assigned to the variable myld and numLet; the following lines are output from your program run. This should all be done in one run of a single program, not several runs. Here are some REQUIREMENTS: 1. Assign personal information (family name, student id) to String variables. 2. Hardcode values for myld and nLet. 3. Assign the arithmetic expression results to a variable. Use as few variables as possible. 4. Use a space around operators. 5. Perform the necessary data conversions to perform arithmetic operations. 6. As you can see in the sample run, the first thing your program needs to do is print out the values for your family (last) name and your student ID. 7. Ensure that your solution is well organized. Providing comments to organize your source code is recommended. 8. Format floating point numbers to 1 decimal place for expression 3 and to 5 decimal places for expression 6. 9. Title your program filename to read ArithYourLastName (e.g. for the example run provided the class name would be ArithStudent.java). .O. Only one run, please, which means you must produce all six answers in your program in a single source file. .1. Expressions #1, #2 #4 and #5 should use ordinary int arithmetic, which means using the int variables without any special tools. However, expressions #3 and #6 are meant to display the double accuracy that the divisions will produce, You should take appropriate action to do that. .2. Use as few variables as possible. You can, for example, use one intResult variable for the four int expressions and a second doubleResult variable for the two double expressions. However, not to use six separate result variables.
Expert Solution
Step 1: The Algorithm of the 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.

steps

Step by step

Solved in 5 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY