Income Tax Calculator Written Assessment Due September 21, 2012

Objective: Use interfaces, methods and drivers in order to create and test methods using two different classes. Using the Income Tax Calculator on page 80 of your text book, modify the existing source code and provide the calculation as a method using appropriate parameters in the parameter list. The income and dependents should be method parameters. The taxable income and income tax should be variables local to the scope of the method that you are testing. Test with user input. Successful completion of this programming project (assessment grade) includes the following:

Coding Standard

  1. All curly braces will be on their own lines.
  2. All loops will have curly braces.
  3. Opening curly braces will line up with the first character in the line above. Close curly brace at same level of corresponding curly brace.
  4. Every function, class, or interface must have a comment block before it.
  5. All methods must be tested separately with a screen shot of the implementation and successful test.
  6. All programs must be tested for logical accuracy with a screenshot of the results.
  7. All programs must be tested for logical accuracy with a separate driver class.

Comment Block

/**

* Each function will have a leading comment

* block explaining what the function does.

*

* Pre-Conditions: Any condition that must be true before this

* function is run.

* Post-Conditions: Any condition that must be true after this

* function is run.

* @author Full Name

* Last Modification:

*

*/

Formatting Standards

Title page on top of all assignments.

10 - 12pt Times New Roman

1” margins with .5” gutter

Screen shot of document properties before the printed source code.

Screenshot of method testing after the printed source code.

Rubric as the last sheet in the packet.

See example as part of this document.

Naming

Names must always be descriptive of the element they represent.

Classes –nounsin mixed case with first letter of internal words capitalized
class Raster
class ImageSprite

Methods –verbsin mixed case with first letter lowercase and first letter of internal words capitalized
run();
runFast();

Variables – mixed case with first letter lowercase and first letter of internal words capitalized
intmaxSize = 100;
double perCent = .25;

ClassConstants- all capitalized characters and should be created at the top of the Class
public static final type SIZE = 4;

Indentation

Increase level of indentation after all opening curly braces

Stay at a single level of indentation for an entire block

When continuing a line, indent one more tab than the original one

Method Description:Each new method needs to have a description comment above its declarationbrieflydescribing its functionality.

New Line:Start a new line after every ; or }

Space between Methods:Skip exactly one line between methods

Main Placement:Main method must be at the top

Max Line Length:The maximum line length should be 100 characters for readablity. Continued lines should indent one more tab relative totheiroriginal one

(Leveraged from Ms Martin’s Coding Conventions in previous years, these are good & standard one’s)

Programming Project Name

Charles Herbert Flowers High School

Student Full Name

Advanced Placement Computer Science

Ms. Shanice M. White

Due Date Goes Here

/*

* author Full Name

* ProgramName.java

* Last Modification:

*/

//*******************************************************
// Account.java
//
// A bank account class with methods to deposit, withdraw,
// and check the balance.
//*******************************************************
publicclass Account
{
privatedouble balance;
private String name;
privatelongacctNum;

//------
//Constructor -- initializes balance,

//owner, and account number
//------
public Account(doubleinitBal, String owner, long number)
{
balance = initBal;
name = owner;
acctNum = number;
}

//------
//Constructor -- initializes balance and owner;

//generates randomaccount number
//------
public Account(doubleinitBal, String owner)
{
balance = initBal;
name = owner;
acctNum = (int) (Math.random() * Integer.MAX_VALUE);
}

//------
//Constructor -- initializes owner as given and

//balance to 0.
//Generates random account number
//------
public Account(String owner)
{
balance = 0;
name = owner;
acctNum = (int) (Math.random() * Integer.MAX_VALUE);
}

//------
// Checks to see if balance is sufficient for

//withdrawal.If so, decrements balance by

//amount; if not, prints message.
//------
publicvoid withdraw(double amount)
{
if (balance >= amount)
balance -= amount;
else
System.out.println("Insufficient funds");
}

//------
// Checks to see if balance is sufficient for

//withdrawal.If so, decrements balance by

//amount; if not, prints message.
// Also deducts fee from account.
//------
publicvoid withdraw(double amount, double fee)
{
if (balance >= amount)
{
balance -= amount;
balance -= fee;
}
else
System.out.println("Insufficient funds");
}

//------
// Adds deposit amount to balance.
//------
publicvoid deposit(double amount)
{
balance += amount;
}
//------
// Returns balance.
//------
publicdoublegetBalance()
{
return balance;
}
//------
// Returns account number
//------
publicdoublegetAcctNumber()
{
returnacctNum;
}
//------
// Returns a string containing the name, acct number, and //balance.
//------
public String toString()
{
return"Name: " + name +
"\nAcct #: " + acctNum +
"\nBalance: " + balance;
}
}


Grading Rubrics

Java Program (50 pts)

This assignment is to write an application using the Java programming language.

Program (50 pts) / (Excellent) / (Good) / (Fair) / (Poor)
Program execution / Program executes correctly with no syntax or runtime errors (9-10) / Program executes with a minor (easily fixed error) (2-3) / Program does not execute (0-1)
Correct output / Program displays correct output with no errors (9-10) / Output has minor errors (6-8) / Output has multiple errors (3-5) / Output is incorrect (0-2)
Design of output / Program displays more than expected (7-8) / Program displays minimally expected output (5-6) / Program does not display the required output (3-4) / Output is poorly designed (0-2)
Design of logic / Program is logically well designed (9-10) / Program has slight logic errors that do no significantly affect the results (6-8) / Program has significant logic errors (3-5) / Program is incorrect (0-2)
Standards / Program is stylistically well designed (6-7) / Few inappropriate design choices (i.e. poor variable names, improper indentation) (4-5) / Several inappropriate design choices (i.e. poor variable names, improper indentation) (2-3) / Program is poorly written (0-1)
Documentation / Program is well documented (5) / Missing one required comment (4) / Missing two or more required comments (2-3) / Most or all documentation missing (0-1)