Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

MP34 Midterms

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 2

MP3

Create a class named NewspaperSubscriber with fields for a subscribers street


address and the subscription rate. Include get and set methods for the subscribers
street address, and include get and set methods for the subscription rate. The set
method for the rate is abstract. Include an equals() method that indicates two
Subscribers are equal if they have the same street address.
Create child classes named SevenDaySubscriber, WeekdaySubscriber, and
WeekendSubscriber. Each child class constructor sets the rate as follows:
SevenDaySubscribers pay $4.50 per week, WeekdaySubscribers pay $3.50 per
week, and WeekendSubscribers pay $2.00 per week.
Each child class should include a display() method that returns the street address,
rate, and service type. Write an application named Subscribers that prompts the
user for the subscribers street address and requested service, and then creates the
appropriate object based on the service type. Do not let the user enter more than
one subscription type for any given street address.
Save the files as NewspaperSubscriber.java, WeekdaySubscriber.java,
WeekendSubscriber.java, SevenDaySubscriber.java, and Subscribers.java.

MP4
Sanchez Construction Loan Co. makes loans of up to $100,000 for construction
projects. There are two categories of Loansthose to businesses and those to
individual applicants.
Write an application that tracks all new construction loans. The application must
also calculate the total amount owed at the due date (original loan amount + loan
fee).
The application should include the following classes:
LoanA public abstract class that implements the LoanConstants interface. A Loan
includes a loan number, customer last name, amount of loan, interest rate, and
term. The constructor requires data for each of the fields except interest rate. Do
not allow loan amounts over $100,000. Force any loan term that is not one of the
three defined in the LoanConstants class to a short-term, one-year loan.
LoanConstantsA public interface class. LoanConstants includes constant values
for short-term (1 year), medium-term (3 years), and long-term (5 years) loans. It
also contains constants for the company name and the maximum loan amount.
BusinessLoanA public class that extends Loan. The BusinessLoan constructor
sets the interest rate to 1% over the current prime interest rate.
PersonalLoanA public class that extends Loan. The PersonalLoan constructor
sets the interest rate to 2% over the current prime interest rate.

CreateLoansAn application that creates an array of five Loans. Prompt the user
for the current prime interest rate. Then, in a loop, prompt the user for a loan type
and all relevant information for that loan. Store the created Loan objects in the
array. When data entry is complete, display all the loans. Save the files as
Loan.java, LoanConstants.java, BusinessLoan.java, PersonalLoan.java, and
CreateLoans.java.

You might also like