Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

What is the output from the following print statements, assuming float myFloat = 4 5 . 1 3 4 2 f; 1 ) System.out.printf (

What is the output from the following print statements, assuming
float myFloat =45.1342f;
1)
System.out.printf("%+.5f", myFloat);
+45.13420
Check
Show answer
Correct
+45.13420
The + indicates a + should output before a positive number, and .5 indicates 5 digits should follow the decimal point.
2)
System.out.printf("%.3e", myFloat);
4.513e+01
Check
Show answer
Correct
4.513e+01
e is used to display float values in scientific notation, .3 specifies the digits to print following the decimal point
3)
System.out.printf("%09.2f", myFloat);
00000045.13

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spomenik Monument Database

Authors: Donald Niebyl, FUEL, Damon Murray, Stephen Sorrell

1st Edition

0995745536, 978-0995745537

More Books

Students also viewed these Databases questions