COMP 110-002 Spring 2011

Program 1: Bluth Family Lawyer Consultation

50 points

Assigned: Wednesday, January 19
Due: Wednesday, February 2 at 11:59 pm

Description

The Bluth family has been in trouble with the law ever since George Bluth Sr. was arrested for defrauding investors and gross spending of the company's money. The family has hired the lawyer Bob Loblaw, to represent them. Bob Loblaw charges $13 a minute for his services. The Bluth family needs to determine how much of Bob Loblaw's time they can buy in days, hours, and minutes.

Write a program that asks the Bluth family how much money they can spend for Bob Loblaw's services and then outputs the total number of days, hours, and minutes they can afford. Note: there are 1440 minutes in a day.

Compute the total number of minutes the family can afford (to the nearest minute) and then convert that to days, hours and minutes, in that order.

For example, if you calculated that the Bluths can afford 1503 minutes, the output should read:
1 days, 1 hours, and 3 minutes
It should not be output as:
0 days, 25 hours, and 3 minutes

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

Hello Bluth family.
How much money can you spend for Bob Loblaw's services?
20410

You can afford 1570 minutes.
That is 1 days, 2 hours, and 10 minutes.

Hint

Pay special attention to the paragraph about division on p. 63 of the textbook.

Extra Credit

Change your output to be grammatically correct for all outputs. That is, 1 hour should be singular and 2 hours should be plural. The same is true for days and minutes.

If the Bluth family can afford 1503 minutes, the output should read:

1 day, 1 hour, and 3 minutes

If the Bluth family can afford 1561 minutes, the output should read:

1 day, 2 hours, and 1 minute

What to Do

What to Turn in

Submit via Blackboard the following:

Requirements

When I examine your program, it must satisfy the following requirements. The maximum point value for each is shown in brackets.

  1. [2] You put the standard program header at the top of your code file.
  2. [3] Your class, Java source file, and JAR file must be appropriately named (as specified above).
  3. [2] Your JAR file was created correctly (contains both .java and .class files and MANIFEST file)
  4. [10] You must prompt the user for the amount of money they can pay Bob Loblaw.
  5. [10] You must output the total number of minutes the Bluth family can afford.
  6. [20] You must output the total time in days, hours, and minutes.
  7. [3] You must comment your code, including block-like multi-line comments

    /* This is a
    multi-line comment */


    and single-line comments

    // this is a single line comment

    where appropriate. In addition, your code must be neatly and clearly formatted using appropriate "white space."
  8. [5] Extra Credit
Notes: