Project 1
Project 1
Project 1
Enter
Enter
Enter
Enter
Enter
QTY
2
1
4
1
2
the
the
the
the
the
quantity
quantity
quantity
quantity
quantity
of
of
of
of
of
DESC
Television
VCR
Remote Control
CD Player
Tape Recorder
TVs sold: 2
VCRs sold: 1
remote controls sold: 4
CD players sold: 1
tape recorders sold: 2
PRICE
$400.00
$220.00
$35.20
$300.00
$150.00
TOTAL
$800.00
$220.00
$140.80
$300.00
$300.00
Subtotal: $1760.80
Tax (8.25%):
$145.27
Total: $1906.07
Define constants for the unit prices and the tax rate. Use integer
variables to store the quantities for each item. Use floating-point
variables to store the total price of each item, the bill subtotal,
the tax amount and and the total amount of the bill. Run your program
two times with the following data:
Set 1 -> 2 1 4 1 2
Set 2 -> 3 0 2 0 21
Format the output adequately showing the 4 columns (QTY, DESCRIPTION,
UNIT PRICE, TOTAL PRICE) in a single row. Use System.out.printf for
output.
Proj 2.
The formula for converting centigrade temperature to Fahrenheit is:
F = 32 + C (180.0/100.0)
Write a program that asks the user to enter a temperature reading in
Centigrade and then prints the equivalent Fahrenheit value. It then
asks the user to enter a Fahrenheit value and prints out the
equivalent Centigrade value. Run the program several times. Be sure to
include at least one negative temperature reading in your test
cases.
Use static functions for this lab.
Here is a sample main:
public static void main(String [] args)
{
float c, f;
c = f = 0;
convertCtoFAndPrint(c);
convertFtoCAndPrint(c);
}
Proj 3.
You are required to use loops, decision making constructs and static
functions to write your program.
Depreciation to a salvage value of 0
For tax purposes an item may be depreciated over a period of several
years, n.
With the straight line method of depreciation, each year the item
depreciates by 1/nth of its original value.
With the double-declining method of depreciation, each year the item
is depreciates by 2/nths of its value at the beginning of the year.
(in the last year it is depreciated by its value at the begining of
the year).
Write a program that
1. requests a description of the item, the year of purchase, the cost
of the item, the number of years to be
depreciated(estimated
life), and the method of depreciation.
2. Displays a depreciation schedule for the item similar to the
schedule shown below:
Description: Computer
Year of purchase: 1994
Cost : 2000
Estimated Life: 5
Method of depreciation: Double-Declining
Year
Cost
Dep. Amt
Tot Dep.
1994
2,000.00
800.00
800.00
1995
1,200.00
480.00
1280.00
1996
720.00
288.00
1568.00
1997
432.00
172.80
1740.80
1998
259.20
259.20
2000.00
Description: Computer
Year of purchase: 1994
Cost : 2000
Estimated Life: 5
Method of depreciation: Straight-Line
Year
Cost
Dep. Amt
Tot Dep.
1994
2,000.00
400.00
400.00
1995
2,000.00
400.00
800.00
1996
2,000.00
400.00
1,200.00
1997
2,000.00
400.00
1,600.00
1998
2,000.00
400.00
2,000.00