C++ Programming

cplusplus.com | Java Documentation | Site Stats
AP schedule | AP LogIn | AP Forms | AP Resources | AP Archive | AP Stuff
Java schedule | Java LogIn | Java Forms | Java Resources | Java Archive | Java Stuff
Adven schedule | Adven LogIn | Adven Forms | Adven Resources | Adven Archive | Adven Stuff
Stat schedule | Stat LogIn | Stat Forms | Stat Resources | Stat Archive | Stat Stuff

Java Schedule 3-15-10

Monday 3-15

code Quiz - Card and Deck Class (Java and AP)

code Quiz - AP only

Tuesday

Java and AP

Method Summary
 boolean equals(Card c)
          Determines if two cards have the same cardNum values.
 int getBlackJackValue()
          Determines the Blackjack value of a card.
 String getCardName()
          Converts the cardNum to a String value where 14 is Ace 13 is King 12 is Queen 11 is Jack numbered cards are returned as the card number.
 int getOrder()
          Returns the card number.
 String getSuitName()
          Converts the suitNum to a string representing the suit.
 int getSuitValue()
          Accessor that returns the suit value.
 boolean isAce()
          Determines if a card is an Ace.
 boolean isFaceCard()
          Determines if a card is a face card with cardNum values of 11-13 Face cards - Jack, Queen, and King.
 String toString()
          Returns the card in the form of the card name and the suit.

 

 

		
		public PokerHand(int handType)
    {
        hand = new Card[5];
        if(handType==1)
        {
        hand[0]=new Card(2,13);
        hand[1]=new Card(1,7);
        hand[2]=new Card(3,5);
        hand[3]=new Card(4,7);
        hand[4]=new Card(2,7);  
        }
        
        if(handType==2)
        {
        hand[0]=new Card(1,13);
        hand[1]=new Card(2,11);
        hand[2]=new Card(1,11);
        hand[3]=new Card(3,12);
        hand[4]=new Card(1,13);  
        }
        if(handType==3)
        {
        hand[0]=new Card(1,13);
        hand[1]=new Card(4,14);
        hand[2]=new Card(1,5);
        hand[3]=new Card(2,12);
        hand[4]=new Card(1,13);  
        }
        if(handType==4)
        {
        hand[0]=new Card(1,7);
        hand[1]=new Card(2,9);
        hand[2]=new Card(1,10);
        hand[3]=new Card(4,8);
        hand[4]=new Card(1,11);  
        }
        if(handType==5)
        {
        hand[0]=new Card(1,6);
        hand[1]=new Card(1,14);
        hand[2]=new Card(1,5);
        hand[3]=new Card(1,2);
        hand[4]=new Card(1,13);  
        }
        
        if(handType==6)
        {
        hand[0]=new Card(1,5);
        hand[1]=new Card(4,2);
        hand[2]=new Card(3,5);
        hand[3]=new Card(1,2);
        hand[4]=new Card(2,5);  
        }
        
        
        
        
        //sortHand();
    }//end Hand
		 

AP

Method Summary
 Card getCard(int i)
          Accessor returning a card from the PokerHand
 int getNumDiffCards()
          Determines the number of different cards in the PokerHand Precondition: Hand is sorted.
 boolean isFlush()
          Determines if all five cards are of the same suit.
 boolean isFullHouse()
          Determines if the hand is a full house.
 boolean isOnePair()
          Determines if the hand has exactly one pair.
 boolean isStraight()
          Determines if the hand is a straight.
 boolean isThreeOffKind()
          Determines if a hand contains three of a kind only.
 boolean isTwoPair()
          Determines if a hand contains two pair only.
 void showHand()
          Outputs the PokerHand to the monitor.
 void sortHand()
          Sorts the PokerHand according to the cardNum.

 

Wednesday

Submit Card methods

 

Thursday

Java : Submit the PokerHand methods - due midnight sunday. Half credit after Sunday.

AP(H & K) Deck1 class methods - all due midnight Sunday

private data array of 52 Cards

Deck1 constructor - creates a new deck of Cards in order.
Card getCardFromDeck(int loc) - returns a Card at location loc from the Deck.
cutDeck(int loc) - cuts the deck at loc and replaces the top on the bottom.
cutDeck() - randomly selects a location to cut between 20 and 30 and replaces the top on the bottom.
Submit the methods above by midnight sunday.


shuffleDeck() - cuts the deck at a random location between 20 and 30
perfectShuffle() - cuts the deck at location 26 and shuffles.
showDeck() - outputs the deck
equals(Deck d) - Checks to see if two decks are in the same order.
Submit the methods above by midnight sunday.

AP(H & K) - PokerHand methods due Monday Midnight

Friday

Last Lab Day

Next Week : Tueday code Test - AP and Java.

 

 

 

 

 

 

 

 

http://www.utrace.de

AP - Comparable and compareTo method Quiz (full period)

AP - Introduction to Polymorphism

Monday 3-8

From Friday

Declare a constant in SavingsAccount for a $10 monthly fee
Declare a constant in CheckingAccount for a $12 monthly fee
Declare a constant in StudentChecking for a $5 monthly fee
Submit the constant declarations for each class.

Write a method named chargeMonthlyFee which deducts the monthly fee from the balance for each Class. Submit chargeMonthlyFee for all three classes.

Declare a constant (intRate) in SavingsAccount containing an interest rate of 2.3%.
Write a method (addInterest) to calculate and add the interest to the account.
Submit intRate declaration and addInterest method.

Create a new class named InterestCheckingAccount which extends CheckingAccount.
This class will contain a constant containing an interest rate (intRate) of 1.2%. Write the method (addInterest) to calculate and add the interest rate to the balance. Submit the complete InterestCheckingAccount class.

Add toString methods to the SavingsAccount, CheckingAccount, and StudentCheckingAccount classes. Submit the toString methods for all three classes.

Add a chargeMonthlyFee to InterestCheckingAccount.

Copy and paste the Amain main method code in your main method. Only change the red code. Submit the main method and output.

All submissions above are due midnight Tuesday but you will not have the class period on Tuesday to work on it.

Tuesday

Static variables

Change your basic fee constant to the following variable

private static double basicFee = 10 ;

Make changes to methods that use this variable (was a constant)

Change your Student fee constant to the following variable

private static double studentFee = 5 ;

Make changes to methods that use this variable (was a constant)

Write an updateBasicFee method (changes the fee)
Write an updateStudentFee method(changes the fee)
Write an accessor for studentFee and basicFee variables.

 

Change your Saving Account Interest Rate constant to the following variable :

private static double savIntRate=.023;

Write an updateSavIntRate method
Write an accessor the the savings Interest Rate.

 

Change your Interest Checking Account Interest Rate constant to the following variable:

private static double checkIntRate = .012

Write an updateCheckIntRate method
Write an accessor for the checkIntRate variable

Change toString methods to output the following information for the interest accounts :

Initials  Balance=<balance>  current Interest rate = <current rate> fee charge = <fee charge>

Change toString methods to output the following information for the non interest accounts :

Initials Balance=<balance> fee charge = <fee charge>

Wednesday

Submit the Amain output from Tuesday.

 

Add the following to the Account class private data

private static String nextAccNum = "1234000";

In Account write

public static String getNewAccountNumber()

Create an Integer object with nextAccNum.

Create a primitive int variable and assign it the intValue from the Integer object plus 1.

assign nextAccNum the int created above.

return the primitive int value.

 

Sample output for Amain (public static void main code)

My Name is kedigh
Account Balances
1234001 S.B. Balance : $350.0 Current Interest rate : 0.023 Fee Charge : 10.0
1234002 D.P.H. Balance : $700.0 Fee Charge : 10.0
1234003 C.A. Balance : $100.0 Fee Charge : 5.0
1234004 D.H. Balance : $434.0 Fee Charge : 10.0 Current Interest rate : 0.012
Account Balances after Monthly Fees
1234001 S.B. Balance : $340.0 Current Interest rate : 0.023 Fee Charge : 10.0
1234002 D.P.H. Balance : $690.0 Fee Charge : 10.0
1234003 C.A. Balance : $95.0 Fee Charge : 5.0
1234004 D.H. Balance : $424.0 Fee Charge : 10.0 Current Interest rate : 0.012
Account Balances after Interest added
1234001 S.B. Balance : $347.82 Current Interest rate : 0.023 Fee Charge : 10.0
1234002 D.P.H. Balance : $690.0 Fee Charge : 10.0
1234003 C.A. Balance : $95.0 Fee Charge : 5.0
1234004 D.H. Balance : $429.088 Fee Charge : 10.0 Current Interest rate : 0.012

Thursday

Submit the output from wednesday.

Read Lewis 382-404 subclass, superclass, derived class, base class, parent, sibling. more

Abstract Classes and Interfaces

New Project : Chaos
Characters and Weapons (one an interface, one and abstract class)

Sun site
JavaBeginner
www.java2s.com
cogeco

Friday

Submit and I will reply with the questions missed. Two submissions per question set.

Inheritance True-False
Inheritance Multiple Choice
Inheritance Completion
Inheritance Matching

 

 

 

Updated: Thursday, March 18, 2010 9:08 AM

About | Site Map | Contact | Search | ©2005 brentwoodhigh.com