CodeLab 10.16.06

CodeLab 10.16.06 - CodeLab: 10.16.06 Given a floating point...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CodeLab : 10.16.06 Given a floating point variable fraction, write a statement that displays the value of fraction on the screen. Do not display anything else on the screen—just the value of fraction. System.out.println(fraction); Given an integer variable i and a floating point variable f, write a statement that writes the values of i and f to standard output in the following format: i = value-of-i f = value-of-f System.out.println("i = " + i + " f = " + f); Declare a variable x, suitable for storing values like: 3.14159 and 6.02 times ten to the 23rd power double x; Declare a variable temperature and initialize it to 98.6. double temperature = 98.6; Declare a variable precise and initialize it to the value 1.09388641. double precise = 1.09388641; Write a floating point literal corresponding to the value zero. 0F Write a literal corresponding to the floating point value one-and-a-half. 1.5F Write a literal corresponding to the value of the first 6 digits of PI ("three point one four one five nine"). 3.14159
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Declare a float variable named price. float price; Declare a double variable named netWeight. double netWeight; Declare two double variables, one named length with a value of 3.5 and the other named width with a value of 1.55. double length = 3.5; double width = 1.55; Write an expression that computes the sum of two double variables total1 and total2, which have been already declared and assigned values. total1 + total2
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

CodeLab 10.16.06 - CodeLab: 10.16.06 Given a floating point...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online