logo Hurry, Grab up to 30% discount on the entire course
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Sean WoodComputer science
(5/5)

811 Answers

Hire Me
expert
Romesh RanganathanCriminology
(5/5)

784 Answers

Hire Me
expert
Charles MorrissData mining
(5/5)

791 Answers

Hire Me
expert
Pooja DTechnical writing
(/5)

846 Answers

Hire Me
C++ Programming

This content is controlled by your instructor and is not zyBooks content. Direct questions or concerns about this content to your instructor. If you have any technical issues with the ZyLAB submission system, use the Trouble with the lab button at the bottom of the lab.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Students:

This content is controlled by your instructor and is not zyBooks content. Direct questions or concerns about this content to your instructor. If you have any technical issues with the ZyLAB submission system, use the Trouble with the lab button at the bottom of the lab.

1.8 HW5

This homework assignment gives you the opportunity to practice nested structures, passing a structure by reference, and dynamic allocation of an array of structures. There is an extra credit version worth an additional 5 points.

HW5 (Graded out of 100)

Write a program that manages bank accounts. Specifically, the program allows the user to enter the data related to an account, and list the data related to accounts. The data related to an account is maintained in the following structures:

 

struct Person

{

string name;

string address;

};

struct Account

{

int accountNumber; Person ownerInfo; double balance;

};

 

1.   Additional Requirements – Make sure you meet all the requirements to avoid losing points

 

  1. Outline of main

Prompt the user to enter the maximum number of Accounts. Perform input validation. A valid value is an integer > 0.
Dynamically allocate an array of Accounts of the size entered by the user Display the menu of choices:
1->Enter data for specific account, 2->Display data for specific account 3->Display data for all accounts, 4->Quit
Perform input validation on the user’s choice. A user’s choice is valid if it is a choice on the menu.
If the user chooses 1, prompt the user for the account data, do input validation on the account number and balance, and populate the next available element of the
Account array. The next available element is the lowest index element that is not
populated. If there is no available element (array is full), print an error message. Then display the menu again.
If the user chooses 2, prompt the user for the account number. Perform input
validation. If there is no account with that number, print an error message. Else, display the data related to the account. Then display the menu again.
If the user chooses 3, print the data of all the accounts that have been populated. Then display the menu again.
If the user chooses 4, terminate the program.

For all the above input validations, the program should ask the user to reenter as long as the input is invalid, up to 5 attempts (the initial input counts as one attempt). If the maximum number of attempts is reached, the program prints an error message and terminates.

An account number is valid if it is an integer > 0

A balance is valid is it consists only of digits and at most one dot. If there is a dot, there are at most two digits after the dot.

  1. Functions

You are required to implement your program with these functions. You may implement more functions to make your program more modular if you wish.

  • populateAccount: This function takes as arguments the array of Accounts, the number of Accounts populated so far

passed by reference, and the size of the array passed by value. It prompts the user for the data and populates the next available element of the Account array. It performs all the necessary input validations. It prints an error message if there is no available element. The function returns void.
• printAccount: This function takes as argument an Account structure variable passed by reference. It prints the content of the structure variable. The function returns void.
For the two above functions, you must use the proper qualifier(s) to comply with the principle of least privilege. You will fail the unit test if you don’t comply with the principle of least privilege.

a) Style

Make sure you follow the style requirements, especially regarding the comment header for functions, to avoid losing points.

1. Implementation Suggestions – You are not required to implement the suggestions

For the input validation, you can use getline to read the user’s input.
You are allowed to use any of the existing library functions in chapter 10 of the Gaddis textbook to check input validity. You are also allowed to reuse code that you wrote for the previous homeworks.

2. Extra credit

You can earn 5 points extra credit if your program checks the account number entered at choice 1 is not a duplicate of an existing account. If it is a duplicate account number, the program asks the user to reenter, up to 5 attempts (the initial input counts as one attempt). After 5 unsuccessful attempts, the program prints an error message and terminates.

3. Grading Criteria

a) Source code inspection (grader)

Style: 10 points (refer to the “Homework Notes” for the style requirements) If the code does not do dynamic array allocation, 20 points will be deducted

b) Program compilation and execution (zylabs)

Test-1 – Array creation with input validation and menu display – Output starts like output-1: 3 points.

Test-2 – Array creation with input validation, max number of attempts reached – Output matches output-2: 3 points. Test-3 – Display menu with input validation, max number of attempts reached – Output matches output-3: 3 points. Test-4 – Enter data for an account with input validation on the data – Output matches output-4: 9 points

Test-5 – Enter data for an account with input validation on the data, max number of attempts reached – Output matches output-5: 3 points

Test-6 – Enter data for an account, array full – Output matches output-6: 8 points Test-7 – Enter data for an account, array full – Output matches output-7: 8 points

Test-8 – Display data for an account with input validation on the account number– Output matches output-8: 7 points Test-9– Display data for an account, no account found – Output matches output-9: 7 points

Test-10 – Display data for all accounts – Output matches output-10: 19 points

Test-11 (Extra credit) – Enter data for an account with input validation, extra credit – Output matches output-11: 5 points Test-12 – populateAccount unit test: 10 points

Test-13 – populateAccount-full unit test: 5 points

Test-14 – printAccount unit test: 5 points

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme