ICS 240 – Fall 2008-09
Home Works #1
1. Write a program that prompts the user to input the length and width of a rectangle and then prints the rectangle’s area and perimeter.
2. Write a program that does the following:
a) Prompts the user to input five decimal numbers
b) Prints the five decimal numbers
c) Converts each decimal number to the nearest integer
d) Adds the five integers
e) Prints the sum and average of the five integers
3. To make profit, a local store marks up the prices of its items by a certain percentage. Write a Java program that reads the original price of the item sold, the percentage of the marked-up price, and sales tax rate. The program then outputs the original price of the item, the mark-up percentage of the item, the store's selling price of the item, the sales tax rate, the sales tax, and the final price of the item. ( the final price of the item is the selling price plus the sales tax.)
4. The manager of a football stadium wants you to write a program that calculates the total ticket sales after each game. There are four types of tickets—box, sideline, premium, and general admission. After each game, the data is stored in a file in the following form: ticketPrice numberOfTicketsSold
…
Sample data are shown below:
250 5750
100 28000
50 35750
25 18750
The first line indicates that the box ticket price is $250 and that 5750 tickets were sold at that price. Output the number of tickets sold and the total sale amount. Format your output with two decimal places.
5. Write a program to calculate the property tax. Property tax is calculated on 92% of the assessed value of the property. Foe example, if the assessed value is $100000, the property tax is on $92000. Assume that the property tax rate is $1.05 for each $100 of the assessed value. Your program should prompt the user to enter the assessed value of the property. Store the output in