hw4 - prints outs the name and value of each variable, and...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 302 Homework 4 - Due Wednesday, June 29 Name: 1. Write a Java statement to store the decimal value of the fraction 1 / 7 in a variable of type double named seventh . 2. Translate the following mathematical expressions into valid Java expressions: (Note: an expression is not a statement, but simply something that evaluates to a value. For example 3 + 4*7 is an expression while int x = 3 + 4*7; is a statement.) (a) cos( 3 4 ) (b) 3 . 2 4 . 5 5 . 6 (c) 5 2 a and b , write one Java statement that
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: prints outs the name and value of each variable, and their sum. For example, if a = 3 and b = 4 , the statement when executed produces: a: 3 b: 4 sum: 7 4. Write a Java program to rst prompt the user to enter an integral number of days, then read in that number as user input, and nally print that number as output. Hint: You must declare and create a Scanner object . public class InputTester { public static void main(String args) { } }...
View Full Document

This note was uploaded on 08/08/2008 for the course CS 302 taught by Professor Willbenton during the Spring '07 term at Wisconsin.

Ask a homework question - tutors are online