Question
Write a program that demonstrates the approximate nature of floating point numbers. Finish the algorithm we started in class prior to class on Wednesday 3
Write a program that demonstrates the approximate nature of floating point numbers. Finish the algorithm we started in class prior to class on Wednesday 3 February. You will complete the assignment by implementing the algorithm in Java by 2359(Prior to midnight) Wednesday, 3 February.
Get floating point value from user display result of 1.0 / user input value display result of (1.0 / user input value) times user input value display result of (1.0 / user input value) times user input value -1 We discussed in class the use of the IPO chart to help define a solution.
/** *Input *----------- *floating point value *Process *------------ *define variables x and y *define variable product of x and y *define variable result of product - 1 *prompt user of floating point value *store user input into value of x *set y equal to 1.0/x *set product to x times y *set oneMinus equal to product minus 1 *Display product *Display x and y *Display product -1 * *Output *--------- *output product of x and y *output quotient of 1.0/x *output product of (x and y) -1 *output x and y */
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started