COMP 14 Spring 2004

Program 1: Smith Center Banners

75 points

Assigned: Wednesday, January 19
Due: Wednesday, January 26 at 11:59 pm

Description

Coach Roy Williams wants plan ahead for the ACC and NCAA Championship banners that surely will be filling up the rafters of the Dean Smith Center during his years at UNC. Each banner is 400 cm in width and 200 cm in length. Coach Williams needs to know the length of material (in yards, feet, and inches) that he should buy.

Write a program that asks Coach Williams how many banners he expects to earn and outputs the total length of 400 cm wide material he needs to buy, in yards, feet, and inches. Remember that 1 inch is 2.54 centimeters, and 1 centimeter is 0.394 inches.

Compute the total number of centimeters needed for the number of banners entered, convert that to inches (to the nearest inch), and then convert the number of inches to yards, feet, and inches, in that order.

For example, if you calculated that you'd need 123 inches, it should be output as:
3 yards, 1 feet, and 3 inches
It should not be output as:
2 yards, 4 feet, and 3 inches
or
10 feet, 3 inches
or
10.25 feet

Here's an example run (the user input is in italics):

Coach Williams, how many banners will you earn?  12

For 12 banners, you will need
2400 centimeters,
or 26 yards, 0 feet, and 10 inches of 400 cm wide material.
What to Turn in What to Do
  • Follow the directions for completing programming assignments.
  • Name your Java source file Banners.java and your class Banners.

  • Requirements

    When the TA runs/examines your program, it must satisfy the following requirements. The maximum point value for each is shown in brackets.

    1. [5] Your class, Java source file, and Jar file must be appropriately named (as specified above).
    2. [15] You must prompt the user for the number of banners.
    3. [10] You must output the length of material needed in centimeters.
    4. [30] You must output the length of material needed in yards, feet, and inches.
    5. [15] You must comment your code, including block-like multi-line comments and single-line comments where appropriate. In addition, your code must be neatly and clearly formatted using appropriate "white space."
    Notes: