Write code
Write a program that will tell how many inches and feet are in the number of inches in variable size.
import java.util.Scanner;
class Measurements {
public static void main(String[] args){
// read in number of inches
Scanner scan = new Scanner(System.in);
System.out.print("enter number of inches: ");
int size = scan.nextInt( );
// calculate number of feet and inches
// output results
}
}
Matching
- ___ all output in Java is of type
- ___ This type of statement: double d = 35.6;
- ___ change int x into a double in this equation: double avg = (y + ________ x)/2;
- ___ a method of the Scanner class to read in a number with a decimal
- ___ a valid variable name in Java
- ___ same as d = d + 1;
- ___ The reason why this is OK: double d = 8;
- ___ Type of variable to store decimal values.
- ___ Type of variable that uses 'a' single quote for the literal.
|
- char
- (double)
- double
- d++
- nextDouble
- dubble2
- assignment
- String
- widening cast
|
Calculate:
Given:
int a = 9;
double r = 4.5;
- a/5
- a % 3
- a +=2
- a = (int) r;