You will implement a simple program to tabulate the sticker price, net price, and discount rate of selected Massachusetts colleges listed in P.20 of the text. Discount rate is defined as
Your program should produce formatted output similar to the following table.
College
|
Sticker Price
|
Net Price
|
% Discount Rate
|
Amherst College
|
$40,862
|
$17,574
|
55*
|
Harvard University
|
$38,415
|
$18,277
|
55*
|
Hellenic College-Holy Cross
|
$19,503
|
$6,738
|
55*
|
Massachusetts Institute of
|
$39,212
|
$20,660
|
55*
|
Technology
|
|
|
|
Saint John's Seminary
|
$13,750
|
$2,650
|
55*
|
Wellesley College
|
$39,666
|
$18,400
|
55*
|
Williams College
|
$41,434
|
$16,493
|
55*
|
Average
|
$12,345*
|
$12,345*
|
55*
|
* These values must be replaced with your computed values.
Hint: For left alignment, use "2 flag. For example, %-10s specifier makes a string to be left-aligned; it takes at least 10 character spaces. Use Listing 2.1 as an example.
Implementation
Note that you must compute the discount rates and the average values in your program. Pay attention of naming convention and use appropriate data types. For output, use printf.