# Hw3_sol - Homework 3 is due on Thursday 9/22 at 11:30pm...

This preview shows pages 1–2. Sign up to view the full content.

Homework 3 is due on Thursday 9/22 at 11:30pm. Please submit ONLY ONCE when you have all the solutions ready. Only the last submission is graded if you submitted multiple times. NO email submissions are accepted!!! Please only submit the JAVA FILES for the assignment (5 Java files). Please include your name and ID in each Java file's first line as a line comment - for example: // My name, 1234567890. Each problem is 3 points. The total is 15 points. Some people have old versions of the textbook. Please find the problem in the previous textbook versions. ----- 1. your-netid_hw3_1.java : Liang page 148, programming exercise 4.7. (Financial application: computing future tuition) Suppose that the tuition for a university is \$10,000 this year and increases 5% every year. Write a program that computes the tuition in ten years and the total cost of four years' worth of tuition starting ten years from now. public class Exercise4_7 { public static void main(String[] args) { // Use a while loop double tuition = 10000; int count = 1; while (count <= 10) { tuition = tuition * 1.05; count++; } /* // Alternatively use a for loop double tuition = 10000; for (int i = 1; i <= 10; i++) { tuition = tuition * 1.05; } */ System.out.println("Tuition in ten years is " + tuition); double sum = tuition;

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 11/07/2011 for the course CSE 114 taught by Professor Tashbook during the Fall '08 term at SUNY Stony Brook.

### Page1 / 4

Hw3_sol - Homework 3 is due on Thursday 9/22 at 11:30pm...

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

View Full Document
Ask a homework question - tutors are online