Sale!

CSCI 470/680-E Assignment 1 solved

Original price was: $35.00.Current price is: $30.00. $25.50

Category:

Description

5/5 - (2 votes)

The purpose of this very simple assignment is to help you learn and understand the effects of integer division versus floating point division. Look at the results of the arithmetic and try to understand how division statements are processed. It also will help you to use the insertion sequences learned in class during week 1.

Copy your last assignment file and rename it DoublesAndDivision.java.

Remember that all variables are to be declared — and initialized if so — at the top of the main method according to the CSCI 470/680-E Coding and Documentation Guidelines found in Blackboard’s Course Documents. int variables always come before double variables.

Please use exactly the same character strings provided to you below in your System.out.printf statements.

Use appropriate insertion sequences, i.e., %d or %f, to display the numeric values within the character strings.

Declare three integer variables named num1, num2 and num3. Initialize num1 and num2 each to a value between 1 and 100 but make num1 larger than num2. Do not initialize num3.

Declare one double variable named num4. Do not initialize num4.

Display a header, or welcome, message of:

“**** CSCI 470/680-E Assignment 1 Output ****”.

Divide num1 by num2 and store the result in num3.

Display the value stored in num3 with the label “The result of integer num1 divided by integer num2 and stored in an integer is num3”. Plug in the actual numeric values for num1, num2, and num3.

Divide num1 by num2 and store the result in num4.

Display the value stored in num4 with the label “The result of integer num1 divided by integer num2 and stored in a double is num4”. Once again, plug in the actual numeric values for num1, num2, and num4.

Divide num1 by num2 again but this time cast num1 as a double. Store the result in num4.

Display the value stored in num4 with the label “The result of integer num1 (cast as a double) divided by integer num2 and stored in a double is num4”. And, once again, plug in the actual numeric values for num1, num2, and num4.

Display an ending, or trailer, message of:

“**** CSCI 470/680-E Output Complete ****”.

Document very carefully and submit your program on Blackboard as before.