Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Untitled-1 {} tasks.json C Account.h csci 140521_src > C Accounth > ... 1 #include 3 class Account { public: 4 5 6 explicit Account(std::string accountName)
Untitled-1 {} tasks.json C Account.h csci 140521_src > C Accounth > ... 1 #include 3 class Account { public: 4 5 6 explicit Account(std::string accountName) name{accountName} { 7 8 9 10 11 } void setName(std::string accountName) { name = accountName; } 12 13 14 15 16 17 std::string getName() const { return name; } private: std::string name; 18 19 }; 20 Part 2: Activity 1. Implement the class Account from the lecture notes. The source code can be gotten from the lecture notes. Be sure to include all updates to the code that are listed throughout the lecture notes. Also, name the file the same as the class file in the lecture notes and include all the comments. 2. Alter the Account class to have a separate first name (called firstName) and last name (called lastName) data members instead of a single accountName data member. 3. Add an accountNumber data member of type int. 4. Change the type of the data member named balance to a double. 5. Be sure to validate the input. Make sure the account balance and the account number are greater than or equal to zero. 6. Write a setter and getter for all of the new data members and remove any that are no longer used. 7. Alter the constructor to have parameters to initialize all four data members. Of course, the constructor should initialize and validate them. 8. Write a driver program called AccountTest; do not copy the one from the lecture notes. In it write the main method and statements to create two new instances of the class using the new constructor and list initialization. Name the variables account1 and account2. Use the following data: a. acct#: 1001, first name: "Bob", last name: "Biscotti", initial balance: 150.00. b. acct#: 1002, first name: "Allice", last name: "Panitone", initial balance: 1500.00. 9. Output the accounts using the following output format: " with account number has a balance of s.' 11 Replace the placeholders with the objects data. For example: the output of the first account should be: "Bob Biscotti with account number 1001 has a balance of $150.00." Your program files: AccountTest.cpp and Account.h A screenshot of your program running in Visual Studio Code. Please do not to include in the image the rest of your desktop, just the Code window. Be sure that you can see in the image, the entire Code program, the program that you had written (it may not all be visible so show as much as possible), and the output after you ran it
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started