Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

At which times is it safe to assume that the invariants are true? (can be more than one) 1. before the constructor is call 2.

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

At which times is it safe to assume that the invariants are true? (can be more than one)

1. before the constructor is call

2. During the execution of a private method

3. At the very beginning of a private method

4. Right after a public method has finished

5. After the constructor of the class has completed

6. Right after a private method has finished

7. At the very beginning of a public method

8. During the execution of a public method

- O Question 1 Who is responsible for making sure the precondition of a method is true? I The implementer of the client that calls the method The user of the program No answer text provided. The implementer of the method Question 2 Who is responsible for making sure the postcondition of a method is true The implementer of the method No answer text provided. W The implementer of the client that calls the method The user of the program RES Question 7 Consider the following class: public class BankAccount V/minimum balance for all accounts public static int MIN_ACCT_BALANCE = 50; private String cust_name: private String acct_number: private double balance; public void deposit(double amt){ //deposit amt into account //cannot deposit negative dollars balance += amt; public void withdraw(double amt){ //withdraw amt from account //cannot withdraw negative dollars balance -- amt; What would be the precondition for withdraw? (Write it formally) Question 6 Consider the following class: public class BankAccount{ //minimum balance for all accounts public static int MIN_ACCT_BALANCE = 50: private String cust_name; private String acct_number; private double balance; public void deposit(double amt){ //deposit amt into account //cannot deposit negative dollars balance += amt; public void withdraw(double amt){ //withdraw amt from account //cannot withdraw negative dollars balance -= amt; What would be the precondition for deposit? (Write it formally) Consider the following class: public class BankAccount{ //minimum balance for all accounts public static int MIN_ACCT_BALANCE = 50: private String cust_name; private String acct_number: private double balance; public void deposit(double amt){ //deposit amt into account //cannot deposit negative dollars balance += amt; public void withdraw(double amt) [ // withdraw amt from account [/cannot withdraw negative dollars balance -- amt: What would be the invariants for this class? (Write them formally)

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

Step: 3

blur-text-image

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

Oracle PL/SQL Programming Database Management Systems

Authors: Steven Feuerstein

1st Edition

978-1565921429

More Books

Students also viewed these Databases questions

Question

LO2 Explain the nature of the psychological contract.

Answered: 1 week ago

Question

LO1 Discuss four different views of motivation at work.

Answered: 1 week ago