(DUE: )
(Page 94/#2) A "target" heart rate is useful in establishing a suitable exercise level. To determine this rate, subtract your age from 220. The upper limit of your target heart rate is 85 percent of this value; the lower limit is 65 percent. For example, a 40-year-old person can achieve a healthy workout by reaching a heart rate between 117 and 153 beats per minute. Write a Java class called HeartRate with a single method, compute(), to read a person's age and print the range of that person's target heart rate. Your input and output should look like this:
(DUE: )
Write a program that takes the number of hours worked for the week and the rate of pay as input. It then calculates the salary incorporating the "time and a half" rule for overtime (more than 40 hours). When I test your program, I will assume a rate of pay of $9 per hour with the following hourly data: (a) 25 hours and (b) 50 hours.
(DUE: )
(Page 210/#8) Write an application to help do payroll calculations. Your application should read wages and compute and print the State of Illinois tax due (3 percent of wages); your application should continue reading wages until an end of input is encountered. At the end of input, the application should print the total of all wages paid and the total of all Illinois state taxes due. The output of the application should look like this
:
![]()
![]()
![]()
(DUE: )
(Page 168/#6) A CashRegister is an object with nine integer variables: pennies, nickels, dimes, quarters, halfdollars, ones, fives, tens, and twenties. Its operations are the nine operations to add coins or bills to the cash register, namely,
public void addPennies (int p)
public void addNickels (int n)
and so on.These operations can also remove coins or bills when negative arguments are provided. There is also the operation
public int total()
which returns the total amount of money in the cash register, in pennies. Write the CashRegister class. NOTE: You also want to include a toString() method to make output easier.
Use the driver program, CashRegisterClient.java to test your CashRegister class. It may help you to check my output from the driver program.
(DUE: )
EXTRA CREDIT
Extend the true-false exam problem from 4/15, reading directly from the file test.txt, rather than interactively. My interactive version can be found in Testing.java.
(DUE: 5/8)
(a) Write a program to calculate the student and quiz averages for a gradebook. You'll want to consult our lecture of 5/1. In particular, use the data found in gradebook.txt. Your output should be formatted something like (maybe you can do better):
Quiz 1 2 3 Student
Average
87 79 93 86
89 92 90 90
75 85 92 84
65 93 82 80
95 93 100 96
82 88 91 Quiz Average(b) Using the NumberList collection of I/O routines from our lecture of 5-6, discussed in class, rewrite your program to incorporate files (input and output). Of course, the input file should be gradebook.txt. You can name your output file whatever you like, and for the sake of simplicity, forget about labeling the output. Email the source code.