Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello so I need help coding my programming assignment 2, it builds off programming assignment 1 so i'm going to attach programming 1 details below

Hello so I need help coding my programming assignment 2, it builds off programming assignment 1 so i'm going to attach programming 1 details below first then follow up with the details for programming 2 and hopefully with the provided info you guys will be able to code it.

image text in transcribedimage text in transcribedimage text in transcribed

THIS IS THE CODE FOR PROGRAMING 1

Customer.java import java.io.ObjectInputStream.GetField; public class Customer { private String custNumber; private String tin; private String first; private String last; private int margin; private boolean drip; private boolean future; public Customer(String custNumber, String tin){ this.custNumber = custNumber; this.tin = tin; } public Customer(String custNumber, String tin, String first , String last, int margin, boolean drip, boolean future){ this.custNumber = custNumber; this.tin = tin; this.first = first; this.last = last; this.margin = margin; this.drip = drip; this.future = future; } /** * @return the custNumber */ public final String getCustNumber() { return custNumber; } /** * @return the tin */ public final String getTin() { return tin; } /** * @return the first */ public final String getFirst() { return first; } /** * @return the last */ public final String getLast() { return last; } /** * @return the margin */ public final int getMargin() { return margin; } /** * @return the drip */ public final boolean isDrip() { return drip; } /** * @return the future */ public final boolean isFuture() { return future; } /** * @param custNumber the custNumber to set */ public final void setCustNumber(String custNumber) { this.custNumber = custNumber; } /** * @param tin the tin to set */ public final void setTin(String tin) { this.tin = tin; } /** * @param first the first to set */ public final void setFirst(String first) { this.first = first; } /** * @param last the last to set */ public final void setLast(String last) { this.last = last; } /** * @param margin the margin to set */ public final void setMargin(int margin) { this.margin = margin; } /** * @param drip the drip to set */ public final void setDrip(boolean drip) { this.drip = drip; } /** * @param future the future to set */ public final void setFuture(boolean future) { this.future = future; } public String describeCustomer(){ String customerInformation=toString(); return customerInformation; } public String toString(){ String result = ""; result = " Customer "+getCustNumber()+", "+getFirst()+", "+getLast()+" "; result = result +"The account carries the margin limit of "+getMargin()+" "; if(!isDrip()) result = result +"Dividents will be deposited as cash funds "; if(!isFuture()) result = result +"The account is not authorized to trade future contracts "; return result; } }

END OF CODE FOR PROGRAMMING 1

START OF THE INFO FOR PROGRAMMING 2

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

EXPECTED OUTPUT FOR PROGRAMMING 2

image text in transcribedimage text in transcribed

RUBRIC FOR PROGRAMMING 2image text in transcribed

TEST CODE PROGRAMMING 2

/** * This is a SIMPLE test harness for the Security class. * * Keyboard input is accepted from the user and then used to instantiate a Security object. * Once an object has been instantiated, it will be stored in an array. * An enhanced for loop will then be used to output information about all objects in the array. */ import java.util.Scanner; // to accept keboard input public class Test_SecurityHierarchy { private static int limit = 8; private static Security[] custArray = new Security[ limit ]; // declared globally for simplicity public static void main(String[] args) { loadArray( ); outputSecuritys( ); } // end main private static void loadArray( ) { /************************************************************************************************************ * The first part of this method is simply 'set up' for the real work to be done later. * We will: * > Instantiate the Scanner here to accept keyboard input * > Create a 'holding' space for the Security object(s) to be isntantiated * > Declare variables to hold the user responses * > Declare a variable to use in controlling the input loop ************************************************************************************************************/ Scanner input = new Scanner( System.in ); // instantiate Scanner for use; tie to keyboard Security newSecurity; // "holding reference" for the Security object // Both Stock AND MutualFund objects 'fit' here /* * Create prompts for use in input loop */ // Aks what type of object String askObjType = "Do you wish to enter a Stock (1) or a MutualFund (2) ?: "; // Security-level prompts (for SUPERclass instance values) String askCustNumber = "Enter a Customer Number as 7 digits: "; String askPurchDt = "Enter a purchase date in yyyyddd (Julian) format: "; String askPurchPrc = "Enter the purchase price per share: "; String askShares = "Enter the number of shares purchased: "; String askSymbol = "Enter the symbol for the Security: "; // MutualFund prompts (for SUBclass instance values) String askType = "What type of Mutual Fund is this?: "; String askAdmin = "What is the administrative cost cap? Enter as cents per dollar: "; String askRptPeriod = "What is the reporting Period? Enter A (annual), Q (quarterly), or M (monthly): "; String askMgmt = "Is this fund actively (true) or passively (false) managed?: "; // Stock prompts (for SUBclass instance values) String askExchg = "On which exchange is this Stock traded?: "; String askDividends = "Does this Stock pay dividends? (true or false): "; String askDivDate = "In which quarter are dividends paid? Enter 0 if no dividends: "; String askDivAmount = "What is the expectged dividend per share? Enter 0 if no dividends: "; /* * Declare variables to hold the user responses */ // to hold SUPERclass instance values String custNumber; int purchDt; double purchPrc; double shares; String symbol; //================== // to hold MutualFund SUBclass instance values String type; double admin; char rptPeriod; boolean mgmt; //================== // to hold Stock SUBclass instance values String exchange; boolean dividends; int divDate; double divAmount; // Declare a variable to test type of object int objType = 0; // Declare a loop control variable int countObjects = 0; /************************************************************************************************************ * The data input loop will continue until the array has been filled. * * Each prompt is offered in turn; the response from the user is stored in the appropriate variable ************************************************************************************************************/ while( countObjects   Programming Assignment 01 Background This assignment is essentially a review of topics and techniques you learned in IS 2033. You will create a Class (Customer.java) and complete coding a test harness (Test Customer.java) that will perform a minimal, high-level test of the code you created. Provided to you These instructions UML Class Diagram for Class Customer A nearly complete test harness for use in testing your code: Test_Customer.java Expected output results The grading rubric that will be used to grade your submission Deliverables You will submit a zipped folder to Blackboard (as an attachment to the assignment) containing your Java source files: Customer.java . Test_Customer.java DO NOT submit class code (compiled/built code), edit backups (.java files), zipped files, or anything other than those items listed above, in the format specified. Requirements Customer Create the Customer class according to the requirements in the UML Class Diagram for the Customer class. Please note that the UML Class Diagram provided includes all the necessary details-future UML Class Diagrams will more nearly follow common industry usage norms (set and get methods, for example, will be assumed). Test Customer You will need to add/complete two lines of code: 1. 2. 3. Complete the declaration for an array to hold Customer objects. Name the array custArray Add the necessary code in method outputCustomers. DO NOT MAKE CHANGES TO ANY OTHER LINES/ITEMS IN THE TEST HARNESS. Additional Requirements The submitted code (specifically Customer.java) must also follow the published Coding Standards. Especially take note of the following: o Short description of class at beginning of code o Some descriptive comment for each variable o Some descriptive comment for each method o Comments must be logically corredt o Comments must be pertinent to the associated code o Comments should be viewable without scrolling right to see the remaining portion of Code organization o Instance variables should show some organization 'Constructors must appear first ' Set and Get methods should follow constructor(s) - Definition of toString method should dlose the code Other Standards o Only set and get methods may directly access instance values o No single character variable names are permitted o Be generous with white space o Break up code statements if viewing the entire statement on one line will require scrolling right; also consider breaking up statements to add to readability Customer Attributes private custNumber A unique identifier for a customer tin:Strin last: S first: Strin number-TIN, EIN, or SSN last name (or surname) as first al identification l indentification name as private margin: int Margin limit for trading; expressed as whole dollars; if equal to zero -customer is not authorized for margin trading Indicates customer's instructions on dividend reinvestment: true automatic reinvestment; false private drip: boolean ate futures: boolean Indicates whether customer is authorized for futures contracts tra public >Customert nbr: String Two-parm constructor, accepts values for customer number and tax identifier only; returns a reference to a fully functional Custoner object >Customer( nbr: String Full constructor; retums a reference to a fully formed and functional Customer object id: String. IName: String fName: String, lim: int, reUp: boolean, Auth boolean): Custoner lic setCustNumber( nbr: Stri oid Set the value of the instance variable Set the value of the instance variable Set the value of the instance variable Set the value of the instance variable Set the value of the instance variable Set the value of the instance variable Set the value of the instance variable public setTin( id: String): void lic setLast IName: Stri lic setFirst fName: Str lic setMar lic s lim: int : void reUp: boolean ]: void Futures( tAuth: boolean ]: void public getCustNumber) Return value of the instance variable Return value of the instance variable Return value of the instance variable Return value of the instance variable Return value of the instance variable Return value of the instance variable Return value of the instance variable Stri Stri int public getDrip): boolean public getFutures: boolean Returns a formatted String object with a verbose description of the Customer object: Customer custNumber,first Last The account carries a margin limit of $margin The account will reinvest dividends as recieved. The account is authorized to trade in futures contracts. NOTE: Alternates for the last two lines will read "Dividends will be deposited as cash funds." (when drip-false) and "The account is not authorized to trade futures contracts."(when futuresfalse Returns a formatted String object containing raw values of all instance variables: toStringi): String Customer:custNumber, tin, Last.first,margin, dr utures NOTES: All 'set' & 'get' methods should be final. There can be no null constructor defined for this class. Programming Assignment 02 Background We are building on the start made in PA01 to continue building the reporting system for our investment management company. In this assignment, you will build a basic framework for the securities management portion of the system. Provided to you The following have been provided to you These instructions UML Class Diagrams for: o Security o MutualFund o Stock o CostBasis (interface) .Code to do a minimal, high-level test of your work: Test_SecurityHierarchy.java . Sample expected output results from that test harness .The grading rubric that will be used to grade your submission Deliverables Submit your Java source files as a single (and single-leve!! zipped folder. Include the following source modules (only these, and only source!): . Security.java MutualFund.java .Stock.java .CostBasis.java DO NOT submit class code (compiled/built code), edit backups (.javar files), or anything other than those items listed above, in the format specified. Requirements CostBasis Create the CostBasis interface according to the requirements in the UML. The interface will be used in the classes of the Security hierarchy to calculate the cost basis for a given investment, according to the instructions provided in the individual class diagrams. Security Create the Security class according to the requirements in the UML Class Diagram. Note that the UML Class Diagram provided does not include required standard methods- these should be included at all times as defaults. Naming for such methods MUST follow standard naming conventions. All classes in the Security hierarchy must implement the CostBasis interface MutualFund Create the MutualFund class according to the requirements in the UML Class Diagram. Note that the UML Class Diagram provided does not include required standard methods-these should be included at all times as defaults. Naming for such methods MUSI follow standard naming conventions. The MutualFund class must provide concrete instructions for implementation of the CostBasis interface. Stock Create the Stock class according to the requirements in the UML Class Diagram. Note that the UML Class Diagram provided does not include required standard methods- these should be included at all times as defaults. Naming for such methods MUST follow standard naming conventions. The Stock class must provide concrete instructions for implementation of the CostBasis interface Security (Abstract) Interface: CostBasis Attributes A unique identifier for a customer; must be 7 Purchase date of Security in Julian date format: yyvyddd. The value for year must be greater than 1900. The value for days must be between 1 and 365, inclusive in must be than 10000 purchDt: int double share, in dollars te shares: double Number of shares purchased; for dis Market decimal i positions should be limited to three (3 Str of Operations Securityl nbr: String, Ful constructor, returns a reference to a fully formed and functional Security object date: int, price: double, qty: double, sym: String): Security Returns a formatted String object describing the Security object The Security belongs to Customerlf custNumber; shares shares of symbol were purchased on purchDt for SpurchPrc per share. toString():String The interface method calcCost s not given a concrete definition here. There can be no null constructor defined for this class. NOTES: MutualFund (subclass of Security) Attributes private type: String private admin: double private rptPeriod: char Identifies general type of Mutual Fund: bonds, money market, exchange, etc Administrative fee cap, expressed as a percentage of value of funds held (e-g: 0.0024 or 0.03) Reporting period, expressed as character. The valid values are: A: annual Q: quarterly M: te mgmt: boolean Describes whether or not the fund is "act true active; false tions public MutualFund(nbr: String, Full constructor; returns a reference to a fully formed and functional MutualFund object date: int, price: double, qty: double sym: String sort: String, cost: double, rpt: char style: boolean ): MututalFund public toString)String Returns a formatted String object describing the MutualFund object: The MutualFund belongs to Customera custNumber; shares shares of symbol were purchased on purchDt for SpurchPrc per share This is a type fund. Admin costs are capped at admin The fund is managed actively/passively (1) Based on rptPeriod value. (2) Based on mgmt value public calcCost( ): double Interface method: CostBasis Cost is calculated as:(shares purchPrc)(1+admin NOTE: There can be no null constructor defined for this class. Stock (sublcass of private The on which the stock trades (e.g: NASDAQ, Nikkei, etc.) dividends: boolean Indicates whether or not the stock pays dvidends: true dividends paid; false no dividends paid Indicates when dividends are Dollar value of dividents/share; 0 if dividends false and/or divDate is invalid ate divDate: int allowed values are O (if dividends false) thr divAmount: double public MutualFund( nbr: String Full constructor; returns a reference to a fully formed and functional Stock object date: int, pre: double, qty: double, sym: String xchg: String div boolean, divDt: int, amt: double ): Stock public toStringl):String Returns a formatted String object describing this Stock object: This Stock is traded on the exchange This stock does not pay a dividend. A dividend of SdivAmount will be payed in the divDate quarter (1) If dividends false 2 If dividends true Interface method: CostBasis Cost is calculated as: shares public calcCost : double chPrc divAmount NOTE: There can be no null constructor defined for this class. CostBasis (Interface) Attributes no defined attributes for this interface Operations alcCostdouble Returns the cost basis for the Expected Output The following is sample output from the test harness Test_SecurityHierarchy. Your output will depend on the test cases you use. Please keep in mind that I will use multiple, and different, test harnesses when grading your submission -so test thoroughly! Data input complete. Thank you The Mutua!Fund belongs to Customer# 1111111; 25845.000 shares of AAAA were purchased on 2001001 for $1.00 per share This is a MoneyMarket fund Admin costs are capped at 0.001200 Reporting cycle is Monthly The fund is managed passively The cost basis for this investment is: $25,876.01 The Mutua!Fund belongs to Customer# 2222222; 2000.000 shares of BBBB were purchased on 2082002 for $500.80 per share This is a ETF fund Admin costs are capped at 0.604200 Reporting cycle is Annual The fund is managed actively The cost basis for this investment is: $1,004,200.00 The Stock belongs to Customer# 3333333; 100.000 shares of DDDD were purchased on 2003003 for $28.06 per share This Stock is traded on the NYSE exchange This stock does not pay dividends The cost basis for this investment is: $2,806.00 The Stock belongs to Customer# 4444444; 500.000 shares of DDDD were purchased on 2004004 for $200.00 per share This Stock is traded on the NASDAQ exchange A dividend of $1.25 will be paid in the 2 quarter The cost basis for this investment is: $99, 375.00 The stock belongs to Customer# 5555555; 1.000 shares of EEEE were purchased on 2005005 for $256.31 per share This Stock is traded on the CBT exchange This stock does not pay dividends The cost basis for this investment is: $255.31 The stock belongs to customer# 6666666; 2.000 shares of FFFF were purchased on 2006006 for $5000.10 per share This Stock is traded on the NYSE exchange A dividend of $25.80 wil1 be paid in the 3 quarter. The cost basis for this investment is: $9,950.20 The Mutua!Fund belongs to Customer# 7777777; 125,000 shares of HHHH were purchased on 2007807 for $65.00 per share This is a Bond fund Admin costs are capped at 0.8520e0 Reporting cycle is Quarterly The fund is managed actively The cost basis for this investment is: $8,547.50 The Stock belongs to Customer# 8888888; 500.000 shares of 1111 were purchased on 2017e80 for $52.36 per share This Stock is traded on the NASDAQ exchange A dividend of $2.50 will be paid in the 4 quarter The cost basis for this investment is: $24,930.0 Criteria Possible Pts Solution functions properly 20 Security Implements Interface No concrete implementation of abstract/interface methods Defined as abstract No compiler warnings 25 MutualFund Correctly coded as subclass Concrete implementation of interface Results of interface method are correct toString method correct No compiler warnings 25 Stock Correctly coded as subclass Concrete implementation of interface Results of interface method are correct toString method correct No compiler warnings 15 CostBasis follows UML No compiler warnings Add'tl Requirements Comments Code Organization Coding Standards Total 100

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases On The Web Designing And Programming For Network Access

Authors: Patricia Ju

1st Edition

1558515100, 978-1558515109

More Books

Students also viewed these Databases questions