# JAVA homework 1.4

Orçamento $20 USD

Student ID

20196191

My Name is Joshua Ramage

ou will create two int variables into which you will store

Your Foothill College student ID. which is 20196191

The number of letters in your family (last) name. 6

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 each student will have a unique output.

The following five expressions assume that you have stored your student ID into the variable studID, and the number of letters in your last (family) name into the variable numLet. You can manually enter both of these using assignment statements in your program source. No user input allowed. Compute the following five values:

Write a program that computes and displays these five values. Your run should look something like this (although the values will differ for each student):

/* -------------------------- Run ----------------------

My last (family) name is Ying-Kam

My Student ID is 99999998

The number of characters in my last name is 8

Expression #1 ------------ : 0

Expression #2 ------------ : 6

Expression #3 ------------ : ...

...

------------------------------------------------------- */

Note that the first three lines are output from your program, not added after the run. This should all be done in one run of a single program, not several runs.

Here are some tips and REQUIREMENTS:

The "..." is called an "ellipsis" and means "and so forth". So, in expression #4 if your numLet is 8, the expression 1 + 2 + ... + numLet really means 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8. Since we have not covered loops, just use this latter expression to compute result in expression #4.

Do not try to take short cuts. For expression #4, I want to see every number in the computation. As an example, in hint #1 directly above, you see that I listed the entire addition when describing the expression 1 + 2 + ... + numLet, so your program should also use the full expression. Remember that long source code lines (> 80 chars) are illegal according to my style rules.

Your personal info is not supposed to be entered by the user at run-time. You should make assignments to the variables in your program.

Only one run, please, which means you must produce all five answers in your program in a single source file.

Expressions #1, #2 and #4 should use ordinary int arithmetic, which means using the int variables without any special tools. However, expressions #3 and #5 are meant to display the full double accuracy that the divisions will produce, You should take appropriate action to do that.

Use as few variables as possible. You can, for example, use one intResult variable for the three int expressions and a second doubleResult variable for the two double expressions. However, don't use five separate result variables.

As you see in the sample run, the first thing your program needs to do is print out your student ID, your last (family) name, and the number of characters, including special symbols, if any which you are using as a basis for these computations.

Do not use any power or exponential methods to compute #5. First, we haven't had that yet, and second, it is inefficient to use a pow() method to compute small integral powers likes squares or cubes. Instead, use multiplication to compute the power(s) you need.