Questions
Determine the carburizing time necessary to achieve a carbon concentration of 0.50 wt% at a position...

Determine the carburizing time necessary to achieve a carbon concentration of 0.50 wt% at a position 3.3 mm into an iron-carbon alloy that initially contains 0.18 wt% C. The surface concentration is to be maintained at 1.1 wt% C, and the treatment is to be conducted at 1050°C. Assume that D0 = 3.1 × 10-5 m2/s and Qd = 120 kJ/mol. The following table may be useful.

An iron-carbon alloy initially containing 0.227 wt% C is exposed to an oxygen-rich and virtually carbon-free atmosphere at 1080°C. Under these circumstances the carbon diffuses from the alloy and reacts at the surface with the oxygen in the atmosphere; that is, the carbon concentration at the surface position is maintained essentially at 0.0 wt% C. At what position will the carbon concentration be 0.170 wt% after a 9 h treatment? The value of D at 1080°C is 1.9 × 10-10 m2/s.

Nitrogen from a gaseous phase is to be diffused into pure iron at 700°C. If the surface concentration is maintained at 0.19 wt% N, what will be the concentration (in weight percent) 2.3 mm from the surface after 7.5 h? The diffusion coefficient for nitrogen in iron at 700°C is 1.2 × 10-10 m2/s.

z erf(z) z erf(z) z erf(z)
0.00 0.0000 0.55 0.5633 1.3 0.9340
0.025 0.0282 0.60 0.6039 1.4 0.9523
0.05 0.0564 0.65 0.6420 1.5 0.9661
0.10 0.1125 0.70 0.6778 1.6 0.9763
0.15 0.1680 0.75 0.7112 1.7 0.9838
0.20 0.2227 0.80 0.7421 1.8 0.9891
0.25 0.2763 0.85 0.7707 1.9 0.9928
0.30 0.3286 0.90 0.7970 2.0 0.9953
0.35 0.3794 0.95 0.8209 2.2 0.9981
0.40 0.4284 1.0 0.8427 2.4 0.9993
0.45 0.4755 1.1 0.8802 2.6 0.9998
0.50 0.5205 1.2 0.9103 2.8 0.9999

In: Mechanical Engineering

Assume that you recently graduated and you just landed a job as a financial planner with...

Assume that you recently graduated and you just landed a job as a financial planner with the Cleveland Clinic. Your first assignment is to invest $100,000. Because the funds are to be invested at the end of one year, you have been instructed to plan for a one-year holding period. Further, your boss has restricted you to the following investment alternatives, shown with their probabilities and associated outcomes. State of Economy Probability T-Bills Alta Inds. Repo Men American Foam Market Port. Recession 0.1 8.00% -22.0% 28.0% 10.0% -13.0% Below Average 0.2 8.00% -2.0% 14.7% -10.0% 1.0% Average 0.4 8.00% 20.0% 0.0% 7.0% 15.0% Above Average 0.2 8.00% 35.0% -10.0% 45.0% 29.0% Boom 0.1 8.00% 50.0% -20.0% 30.0% 43.0% Barney Smith Investment Advisors recently issued estimates for the state of the economy and the rate of return on each state of the economy. Alta Industries, Inc. is an electronics firm; Repo Men Inc. collects past due debts; and American Foam manufactures mattresses and various other foam products. Barney Smith also maintains an "index fund" which owns a market-weighted fraction of all publicly traded stocks; you can invest in that fund and thus obtain average stock market results. Given the situation as described, answer the following questions. a. Calculate the expected rate of return on each alternative. b. Calculate the standard deviation of returns on each alternative. c. Calculate the coefficient of variation on each alternative. d. Calculate the beta on each alternative. e. Do the SD, CV, and beta produce the same risk ranking? Why or why not? f. Suppose you create a two-stock portfolio by investing $50,000 in Alta Industries and $50,000 in Repo Men. Calculate the expected return, standard deviation, coefficient of variation, and beta for this portfolio. How does the risk of this two-stock portfolio compare with the risk of the individual stocks if they were held in isolation?

In: Finance

Ex if std no: 1abcde, 161667 (a=6, b=1, c=6, d=6, e=7) In my case std 173009...

Ex if std no: 1abcde, 161667 (a=6, b=1, c=6, d=6, e=7) In my case std 173009 Q1) Design a concrete mix by using ACI Method of Mix Design having 28-day characteristic mean strength of 2a MPa for a deck of a residential building at Nebraska. Dry weather and gradually warming temperatures may be expected throughout the working week. Fresh concrete composed of a slump of 90 mm and maximum aggregate size of 25 mm. Determine the amount of water reducing admixture to be used for 0.2b % and 0.c5 %. Deck is a flat surface capable of supporting weight, similar to a floor, but typically constructed outdoors, often elevated from the ground, and usually connected to a building. Decks that need piers or footings must have them installed below the frost line. This will keep the piers from heaving up out of the ground from the strength of the freeze. Reinforcing steel will help keep the piers from cracking. The freeze or frost line is the depth to which the soil freezes or has been known to freeze at some point in the past. It is absolutely critical that the foundations of buildings extend below this point in a soil profile. Except for a few arid locations, soils typically contain water and this water expands approximately nine percent in volume when it freezes. The frost line depth is not consistent around the nation because there is such a dramatic difference in climate from state to state. Deck is composed of 2.5 cm reinforcement and there is no need for piers. The material properties are as follows: For Coarse aggregate: SSD bulk specific gravity: 2.75, absorption capacity = 1.5 %, total moisture: 2.5 %, Dry-rodded unit weight: 15de kg/m3. For Fine aggregate: SSD bulk specific gravity: 2.65, absorption capacity = 1.0 %, surface moisture: 3 %, F.M: 2.6. Cement: Type V, Sp.Gravity: 3.23 Probability constant: 1.22 and standard deviation: 2 MPa.

In: Civil Engineering

Ex if std no: 1abcde, 161667 (a=6, b=1, c=6, d=6, e=7) In my case std 174702...

Ex if std no: 1abcde, 161667 (a=6, b=1, c=6, d=6, e=7)
In my case std 174702
Q1) Design a concrete mix by using ACI Method of Mix Design having 28-day characteristic mean strength of 2a MPa for a deck of a residential building at Nebraska. Dry weather and gradually warming temperatures may be expected throughout the working week. Fresh concrete composed of a slump of 90 mm and maximum aggregate size of 25 mm. Determine the amount of water reducing admixture to be used for 0.2b % and 0.c5 %. Deck is a flat surface capable of supporting weight, similar to a floor, but typically constructed outdoors, often elevated from the ground, and usually connected to a building. Decks that need piers or footings must have them installed below the frost line. This will keep the piers from heaving up out of the ground from the strength of the freeze. Reinforcing steel will help keep the piers from cracking. The freeze or frost line is the depth to which the soil freezes or has been known to freeze at some point in the past. It is absolutely critical that the foundations of buildings extend below this point in a soil profile. Except for a few arid locations, soils typically contain water and this water expands approximately nine percent in volume when it freezes. The frost line depth is not consistent around the nation because there is such a dramatic difference in climate from state to state. Deck is composed of 2.5 cm reinforcement and there is no need for piers. The material properties are as follows:
For Coarse aggregate: SSD bulk specific gravity: 2.75, absorption capacity = 1.5 %, total moisture: 2.5 %, Dry-rodded unit weight: 15de kg/m3.
For Fine aggregate: SSD bulk specific gravity: 2.65, absorption capacity = 1.0 %, surface moisture: 3 %, F.M: 2.6.
Cement: Type V, Sp.Gravity: 3.23
Probability constant: 1.22 and standard deviation: 2 MPa

In: Civil Engineering

Debt: 4,000, 7% semiannual coupon bonds outstanding, $1,000 par value, 18 years to maturity, selling for...

Debt: 4,000, 7% semiannual coupon bonds outstanding, $1,000 par value, 18 years to maturity, selling for 102 percent of par; the bonds make semiannual payments.

Preferred Stock:  10,000 outstanding with par value of $100 and a market value of 105 and $10 annual dividend.

Common Stock: 84,000 shares outstanding, selling for $56 per share, the beta is 2.08

The market risk premium is 5.5%, the risk free rate is 3.5% and Huntington’s tax rate is 32%.

Huntington Power Co. is evaluating two mutually exclusive project that is somewhat riskier than the usual project the firm undertakes; management uses the subjective approach and decided to apply an adjustment factor of +2.1% to the cost of capital for both projects.

Project A is a five-year project that requires an initial fixed asset investment of $2.4 million. The fixed asset falls into the five-year MACRS class. The project is estimated to generate $2,050,000 in annual sales, with costs of $950,000. The project requires an initial investment in net working capital of $285,000 and the fixed asset will have a market value of $225,000 at the end of five years when the project is terminated.

Project B requires an initial fixed asset investment of $1.0 million. The marketing department predicts that sales related to the project will be $920,000 per year for the next five years, after which the market will cease to exist. The machine will be depreciateddown to zero over four-year using the straight-line method (depreciable life 4 years while economic life 5 years). Cost of goods sold and operating expenses related to the project are predicted to be 25 percent of sales.  The project will also require an addition to net working capital of $150,000 immediately. The asset is expected to have a market value of $120,000 at the end of five years when the project is terminated.

Use the following rates for 5-year MACRS: 20%, 32%, 19.2%, 11.52%, 11.52%, and 5.76%

  1. What is project A’s cash flows for years 0-5, NPV, IRR, and PI

In: Finance

I need an answer only for the bold part of the question. 1. Circle: The class...

I need an answer only for the bold part of the question.

1. Circle:

The class has two private instance variables: radius (of the type double) and color (of the type String).

The class also has a private static variable: numOfCircles (of the type long) which at all times will keep track of the number of Circle objects that were instantiated.

Construction:

A constructor that constructs a circle with the given color and sets the radius to a default value of 1.0.

A constructor that constructs a circle with the given, radius and color.

Once constructed, the value of the radius must be immutable (cannot be allowed to be modified)

Behaviors:

Accessor and Mutator aka Getter and Setter for the color attribute

Accessor for the radius.

getArea() and getCircumference() methods, hat return the area and circumference of this Circle in double.

Hint: use Math.PI (https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#PI (Links to an external site.))

2. Rectangle:

The class has two private instance variables: width and height (of the type double)

The class also has a private static variable: numOfRectangles (of the type long) which at all times will keep track of the number of Rectangle objects that were instantiated.

Construction:

A constructor that constructs a Rectangle with the given width and height.

A default constructor.

Behaviors:

Accessor and Mutator aka Getter and Setter for both member variables.

getArea() and getCircumference() methods, that return the area and circumference of this Rectangle in double.

a boolean method isSquare(), that returns true is this Rectangle is a square.

Hint: read the first 10 pages of Chapter 5 in your text.

3. Container

The class has two private instance variables: rectangle of type Rectangle and circle of type Circle.

Construction:

No explicit constructors.

Behaviors:

Accessor and Mutator aka Getter and Setter for both member variables.

an integer method size(), that returns 0, if all member variables are null, 1 either of the two member variables contains a value other than null, and 2, if both, the rectangle and circle contain values other than null.

In: Computer Science

In Java Design a Triangle class (Triangle.java) that extends GeometricObject. Draw the UML diagram for both...

In Java

Design a Triangle class (Triangle.java) that extends GeometricObject. Draw the UML diagram for both classes and implement Triangle. The Triangle class contains: ▪ Three double data fields named side1, side2, and side3 with default values 1.0 to denote three sides of the triangle. ▪ A no-arg constructor that creates a default triangle. ▪ A constructor that creates a triangle with the specified side1, side2, side3, color, and filled arguments. ▪ The accessor methods for all three data fields. ▪ A method named getArea() that returns the area of this triangle. ▪ A method named getPerimeter() that returns the perimeter of this triangle. ▪ A method named toString() that returns a string description for the triangle. return "Triangle: side1 = " + side1 + " side2 = " + side2 + " side3 = " + side3; The formulas to compute the area of a triangle are as follows: ? = (????1 + ????2 + ????3) 2 ???? = √?(? − ????1)(? − ????2)(? − ????3) The implementation for the Triangle’s toString() method is as follows: return "Triangle:\n" + super.toString() + "\nTriangle: side1 = " + side1 + " side2 = " + side2 + " side3 = " + side3; Download the attached project: HomeworkCh11.zip. Complete the HomeworkCh11.java test program as follows 1. Prompt the user to enter a. Each of the three sides of a triangle, b. the Triangle’s color, and c. whether the triangle is filled. 2. The program should create a Triangle object with these sides and set the color and filled properties using the input. 3. The program should display the area, perimeter, color, and true or false to indicate whether it is filled or not. 4.

Create an ArrayList and add at least one of each of the following objects to it: Triangle, String, Rectangle, Date, Circle. The list should contain at least seven objects.

The implementation for instantiating the ArrayList and adding objects to it is as follows: ArrayListlist = new ArrayList(); list.add(new Circle(1.5, "green", true)); list.add(new Date()); 5. Create a loop to display all the elements in the list by invoking its toString method. Use the instanceof operator to invoke the correct getArea() and getPerimeter() methods to display additional information about each shape object.

In: Computer Science

Q1) Suppose that 23 g of each of the following substances is initially at 27.0 ∘C....

Q1)

Suppose that 23 g of each of the following substances is initially at 27.0 ∘C. What is the final temperature of each substance upon absorbing 2.45 kJ of heat?

Part A

gold

Part B

silver

Part C

aluminum

Part D

water

Q2) A 32.5 g iron rod, initially at 22.7 ∘C, is submerged into an unknown mass of water at 63.1 ∘C, in an insulated container. The final temperature of the mixture upon reaching thermal equilibrium is58.4 ∘C.

What is the mass of the water?

Express your answer to two significant figures and include the appropriate units.

Q3)Instant cold packs, often used to ice athletic injuries on the field, contain ammonium nitrate and water separated by a thin plastic divider. When the divider is broken, the ammonium nitrate dissolves according to the following endothermic reaction:
NH4NO3(s)→NH+4(aq)+NO−3(aq)
In order to measure the enthalpy change for this reaction, 1.25 g of NH4NO3 is dissolved in enough water to make 25.0 mL of solution. The initial temperature is 25.8 ∘C and the final temperature (after the solid dissolves) is 21.9 ∘C.

Part A

Calculate the change in enthalpy for the reaction in kilojoules per mole. (Use 1.0g/mL as the density of the solution and 4.18J/g⋅∘C as the specific heat capacity.)

Express your answer to two significant figures and include the appropriate units.

Q4)Zinc metal reacts with hydrochloric acid according to the following balanced equation.

Zn(s)+2HCl(aq)→ZnCl2(aq)+H2(g)

When 0.107 g of Zn(s) is combined with enough HCl to make 54.4 mL of solution in a coffee-cup calorimeter, all of the zinc reacts, raising the temperature of the solution from 22.3 ∘C to 24.3 ∘C.

Part A

Find ΔHrxn for this reaction as written. (Use 1.0 g/mL for the density of the solution and 4.18 J/g⋅∘C as the specific heat capacity.)

In: Chemistry

KB, a 91 year old male presenting with a complaint of onset of acute back pain...

KB, a 91 year old male presenting with a complaint of onset of acute back pain this AM, along with fever noted upon admission to the ER. HPI: The patient noted acute lower back pain today either when getting up from chair or getting into bed (he is unclear) early today. Tylenol at home and ice packs were not helpful and he was unable to ambulate or get out of bed. He was brought to the ER by Rescue. In the ER he was noted to be in acute pain as well as having a fever of 103 rectally. Full culture were done. He also had XRAY of the thoracic and lumbar spine. He was also admitted and discharged a week ago for change in mental status and diagnosed with pontine stroke. He was discharged home on noted medications as well as prednisone for ankle OA. He has a cough in the hospital but had improved in the last few days. The patient denies SOB or CP and also note no dysuria, N/V or diarrhea. He is admitted for the fever and r/o bactermia. (CXR pending). Current coverage with Vancomycin and Zosyn. Past Med Hist: Diabetes Mellitus, Arthritis, Transfusion history, GI bleeding (current admission), History of bleeding ulcers, Depression, Spinal stenosis, essential hypertension, Past Surg Hist: Back surg Joint replacement Total knee arthroplasty Foot surgry Proceedure: EGD (Esophagogastroduodenoscopy) with Biopsy. Open Laminectomy lumber 2/3 and L3-4 for spinal stenos Former smoker. Family hist: Cancer: brother Allergies: NSAIDS- avoid because of ulcer hx. Tylenol – Acetaminophen: Slight Itching Neurological: He is alert. Positive for weakness, Neg for dizziness. Sluggish and trouble to answer some questions, however he had 6 mg morphine prior to exam. V/S: BP 184/92 | Pluse 117 | Temp 39.1 C (102.4 F) (oral) | Resp 30 | Ht 5’ 10” | Wt 90.719 kg (200lb) IBM 28.70 kg/m2 | SpO2 92% Physical Exam: He appears well-developed and well-nourished, distressed. HENT: normal. Tachycardiac in 90-100 range. No stridor. No respiratory distress. No wheezes. He has rales (at the bases after 2 liters of fluid in the ER Labs: WBC: 9.04 RBC normal Hemo normal Mean Corpus Hgb normal Neutrophil% 92.4 40.0-70.0% Lymp 2.0 24.0-44.0% Monocyte 4.9 2.0-11.0% Eosin 0.1 1.0-4.0 Baso 0.3 0.0-2.0 Immature Granu 0.03 0.00-0.05 Eosin Absolute 0.01 0.12-0.30 Assessment: 1. Fever: full culture done and antibiotic started 2. Back pain: No findings on imaging studies. Might be secondary to infection elsewhere such as pneumonia. 3. DM2: Continue current meds 4. HTN: continue current meds Problem List: Epidural Abscess Resulved. Ankle inflammation (Right) Type 2 diabetes CVA Lumber Spinal stenosis Increase weakness when ambulating Essential hypertension Sinus pause Confusion GI bleeding due to NSAIDs Altered mental Status, unspecified. Osteomyelitis due to Staphylococcus aureusType 2 DM with hyperglycemia, without long term current use of insulin. Atelectasis Slow transit constipation CVA due to thrombosis of precerebral artery DVT Hypokalemia Soft tissue injury Hyperkalemia Fall risk Laminectomy defects are present at L2 -3 Levoscoliosis of the limber spine centered at L4-5. Findings: There remains edema within the L2 and L3 vertibral bodies as well as the Invertibral discs. There is stable moderate loss of tissue within the prevertebral soft tissues as well as the left psoas muscular tear L2-3 Facet hyperthophy as well as the epidural fluid collection remaining. Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Nursing Assessment 20% • Demonstrate understanding of components of nursing assessment for this pt. 8 point. Clinical Understanding 30%. • Demonstrate through understanding of pt’s diagnoses, treatment and potential complications. 12 points Rarely, back pain is caused by a potentially serious spinal condition, such as infection, fracture, or tumor, or a disorder called cauda equina syndrome, which causes leg weakness and bowel or bladder dysfunction as well as back pain. Back pain that is associated with leg pain, numbness, or weakness can be due to a herniated disc or spinal stenosis. Plan of Care 20% • Outline a complete and effective plan of care for the pt. • Priority nursing diagnoses while caring for pt. • Also provide nursing diagnoses on admission. 8 points. = Professional Rules 20% • Demonstrates understanding of roles of professional team members. (roles of other professionals in care of the patient. (8 points). Assignment Instructions 10% • Follow all instructions in the assignment. (Including comprehensive responses to all questions related to the pt. (4 points) Sample comprehensive questions that she would expect responses from each one of us. Therefore, let prepare to answer them. 1. What first action should the nurse (you) take for this patient and what are the rationales for these actions. 2. For what clinical manifestations should you assess to correlate his acute back pain and fever 3. What nursing care should the nurse continue to provide (the role of the nurse during the management of this client’s condition)? 4. Prioritize nursing diagnoses and collaborative problems for this patient. 5. What potential complications are associated with this patient’s condition? 6. What patient education should the nurse provide?

In: Nursing

This is in JAVA Bank Accounts 01: Child Classes Copy the following SimpleBankAccount class and use...

This is in JAVA

Bank Accounts 01: Child Classes

Copy the following SimpleBankAccount class and use it as a base class:

/**
 * Simple representation of a bank account
 *
 * @author Jo Belle
 * @version 0.5 (10/12/2020)
 */

import java.text.NumberFormat;

public class SimpleBankAccount{
    // fields (instance variables)
    private double balance;
    private String accountId;

    /**
     * Constructor for objects of class SimpleBankAccount
     */
    public SimpleBankAccount(){
        balance = 0.0;
        accountId = "";
    }

    /**
     * Constructor for objects of class SimpleBankAccount
     */
    public SimpleBankAccount( double bal, String id ){
        balance = bal;
         accountId = id;
    }

    /**
     * Add money to the balance
     *
     * @param  amount the amount to deposit
     * @return void
     */
    public void deposit( double amount ){
        balance += amount;
    }

    /**
     * Remove money from the balance
     *
     * @param  amount the amount to withdraw
     * @return true (success) or false (failure)
     */
    public boolean withdraw( double amount ){
        if( balance - amount >= 0 ){
            balance -= amount;
            return true;
        }else{
            return false;
        }
    }

    /**
     * Get the balance
     *
     * @return the balance
     */
    public double getBalance(){
         return balance;
    }

    /**
     * Set account ID
     *
     * @param the account ID
     */
    public void setAccountId(String id){
         accountId = id;
    }


    /**
     * Get the account ID
     *
     * @return the account ID
     */
    public String getAccountId(){
         return accountId;
    }

    /**
     * Produces a string represenation of the balance
     * @return The balance (with a label)
     */
    public String toString( ){
        // display balance as currency
        String balanceStr = NumberFormat.getCurrencyInstance().format( balance );
        return "Balance for account " + accountId + ": " + balanceStr + "\n";
    }
}

Include at least two classes: CheckingAccount and SavingsAccount. Save your CheckingAccount class in a file named CheckingAccount.java and your SavingsAccount class in a file named SavingsAccount.java. Your CheckingAccount class needs to add a field to track the last processed check number. Also include both a no-argument constructor and a parameterized constructor (that takes a double and a String). Furthermore, include the following method:

public boolean processCheck( int checkNum, double amount );

which returns false if checkNum has the same check number as the last check processed, otherwise it reduces the balance by amount and returns true.
Your SavingsAccount class needs to have a field for the interest rate. Also include both a constructor that just takes the interest rate (as a double) and a parameterized constructor (that takes a double, String and a double). Furthermore, include an applyInterest() method that multiples the current balance by the interest rate, and adds that to the balance.
The following code should work and produce the output below:

/** 
 * Exercises the basic functionality of a Checking and SavingsAccount
 *
 * @author Jo Belle
 * @version 0.3 (10/12/2020)
 */
public class AccountsDriver{
    final public static double INTEREST_RATE = 0.01;  // 1%

    public static void main( String[] args ){
        CheckingAccount checking = new CheckingAccount( 100.0, "checking123" );
        SavingsAccount savings = new SavingsAccount( 1000.0, "savings124", INTEREST_RATE );

        double monthlyExpenses = 756.34;
        int electricBillCheckNum = 2123;
        double electricBill = 60.34;
        int registationCheckNum = 2124;
        double registration = 50.00;
        double dinnerMoney = 55.32;
        double futureCar = 200.0;
        double textbook = 90.0;

        // checking account transactions
        checking.deposit( monthlyExpenses );
        checking.processCheck( electricBillCheckNum, electricBill );
        checking.withdraw( dinnerMoney );
        checking.processCheck( registationCheckNum, registration );
        System.out.print( checking.toString() );
        System.out.println( );

        // savings account transactions
        savings.deposit( futureCar );
        savings.applyInterest( );
        savings.withdraw( textbook );
        System.out.print( savings.toString() );
        System.out.println( );
    }
}

Output:

Checking Account:
Balance for account checking123: $690.68
Last processed check number: 2124

Savings Account:
Balance for account savings124: $1,122.00
APR: 1.0%

Make just the necessary changes to the code in SimpleBankAccount to complete the instructions.
Submit the following files:

  • CheckingAccount.java
  • SavingsAccount.java
  • SimpleBankAccount.java

Bank Accounts 02: Overriding 1

Building off of the Bank Accounts 01 practice assignment above, in your CheckingAccount and SavingsAccount classes, override the toString() method. Additionally include a call to SimpleBankAccount's toString() method. Use the appropriate annotation to designate that you're expecting this method to override another method.
Submit the following files:

  • CheckingAccount.java
  • SavingsAccount.java
  • SimpleBankAccount.java

Bank Accounts 03: Overriding 2

Building off of the Bank Accounts 01 practice assignment above, add an equals() method that returns true if all of the fields match and false otherwise. The Object class has the following method:

public boolean equals( Object obj )

To override this method, you must have the same method header. Additionally, to use the fields of the class that overrides the method, you need to cast the parameter to the current class.
Your equals methods should work so that the following code will execute, but not display anything:

/** 
 * Exercises equals()
 *
 * @author Jo Belle
 * @version 0.1 (10/12/2020)
 */
public class BankAccounts03{
    final public static double INTEREST_RATE = 0.01;  // 1%

    public static void main( String[] args ){
        CheckingAccount checking = new CheckingAccount( 100.0, "checking123" );
        SavingsAccount savings = new SavingsAccount( 1000.0, "savings124", INTEREST_RATE );

        CheckingAccount checkingCopy = new CheckingAccount( 100.0, "checking123" );
        SavingsAccount savingsCopy = new SavingsAccount( 1000.0, "savings124", INTEREST_RATE );

        if( checking.equals( checkingCopy ) == false ){
            System.err.println("ERROR: The following objects are equal:");
            System.err.println( checking );
            System.err.println( checkingCopy );
        }

        if( savings.equals( savingsCopy ) == false ){
            System.err.println("ERROR: The following objects are equal:");
            System.err.println( savings );
            System.err.println( savingsCopy );
        }

        int electricBillCheckNum = 2123;
        double electricBill = 60.34;
        double futureCar = 200.0;

        checking.processCheck( electricBillCheckNum, electricBill );

        savings.deposit( futureCar );
        savings.applyInterest( );

        if( checking.equals( checkingCopy ) == true ){
            System.err.println("ERROR: The following objects are NOT equal:");
            System.err.println( checking );
            System.err.println( checkingCopy );
        }

        if( savings.equals( savingsCopy ) == true ){
            System.err.println("ERROR: The following objects are NOT equal:");
            System.err.println( savings );
            System.err.println( savingsCopy );
        }
    }
}


Submit the following files:

  • CheckingAccount.java
  • SavingsAccount.java
  • SimpleBankAccount.java

In: Computer Science