Create a driver class to do the following:
a.
Read data from the given file BankData.data and create and array of BankAccount Objects
The order in the file is first name, last name, id, account number, balance. Note that account
name consists of both first and last name
b.
Print the array (without account id) the account balance must
show only 2 decimal digits. You will need to do some string processing.
c.
Find the account with largest balance and print it
d.
Find the account with the smallest balance and print it.
e.
Determine if there are duplicate accounts in the array. If there are then set the duplicate account
name to XXXX XXXX and rest of the fields to 0. Note it’s hard to “delete” elements from an array.
Or add new accounts if there is no room in the array. If
duplicate(s) are found, print the array.
Main.cpp
#include <iostream>
#include <fstream>
#include <string>
#include //your header file
using namespace std;
const int SIZE = 8;
void fillArray (ifstream &input,BankAccount
accountsArray[]);
int largest(BankAccount accountsArray[]);
int smallest(BankAccount accountsArray[]);
void printArray(BankAccount accountsArray[]);
int main() {
//open file
//fill accounts array
//print array
//find largest
//find smallest
//find duplicates and print if necessary
BankAccount accountsArray[SIZE];
fillArray(input,accountsArray);
printArray(accountsArray);
cout<<"Largest Balance:
"<<endl;
cout<<accountsArray[largest(accountsArray)].toString()<<endl;
cout<<"Smallest Balance
:"<<endl;
cout<<accountsArray[smallest(accountsArray)].toString()<<endl;
}
}
void fillArray (ifstream &input,BankAccount
accountsArray[]){
}
int largest(BankAccount accountsArray[]){
//returns index of largest account balance
}
int smallest(BankAccount accountsArray[]){
//returns index of smallest
}
BankAccount removeDuplicate(BankAccount account1, BankAccount
account2){
return (account1.equals(account2));
}
void printArray(BankAccount accountsArray[]){
cout<<" FAVORITE BANK - CUSTOMER DETAILS
"<<endl;
cout<<"
--------------------------------"<<endl;
//print array using to string method
}
BankData.data
Matilda Patel 453456 1232 -4.00 Fernando Diaz 323468 1234 250.0 Vai vu 432657 1240 987.56 Howard Chen 234129 1236 194.56 Vai vu 432657 1240 -888987.56 Sugata Misra 987654 1238 10004.8 Fernando Diaz 323468 1234 8474.0 Lily Zhaou 786534 1242 001.98
In: Computer Science
In well-governed companies, a sense of accountability and ethical leadership create a culture that places organizational ethics above all else. What role does organizational culture play in preventing financial shenanigans from being used to manage earnings?
In: Finance
Could someone please tell me what corrections I should make to this code. (Python)
Here are the instructions.
I can't get the find function to work and I have no idea how to even go about it. For example, when type in 'find' and I enter the rating, I'm always getting an error. I need help.
def list(movie_list):
if len(movie_list) == 0:
print("There are no movies in the list.\n")
return
else:
i = 1
for row in movie_list:
print(str(i) + ". " + row[0]+ " (" + str(row[1]) + ")"+","+
"$"+str(row[2])+","+str(row[3]))
i += 1
print()
def add(movie_list):
name = input("Name: ")
year = input("Year: ")
price = int(input("Price:"))#price
rating =input("Rating:")
movie = []
movie.append(name)
movie.append(year)
movie.append(price)#adding price to the movie list
movie.append(rating)#adding rating to the movie list
movie_list.append(movie)
rating_list.append(movie)
print(movie[0] + " was added.\n")
def delete(movie_list):
number = int(input("Number: "))
if number < 1 or number > len(movie_list):
print("Invalid movie number.\n")
else:
movie = movie_list.pop(number-1)
print(movie[0] + " was deleted.\n")
#find by rating function
def find_by_rating(movie_list,rating):
if len(movie_list)==0:
print("Find")
return
else:
movie_list=[]
for i in movie_list:
if i[3]==rating:
movie_list.append(i[0])
if len(1)==0:
print("No movies are present with given rating")
else:
print("Movies:")
for i in movie_list:
print(i)
def display_menu():
print("COMMAND MENU")
print("list - List all movies")
print("add - Add a movie")
print("del - Delete a movie")
print("find- find movie by rating")
print("exit - Exit program")
print()
def main():
movie_list = [["Matrix",1999,9.75,"R"],
["Under the Tuscan",2003,4.99,"PG"],
["V for Vendetta", 2005,14.99,"R"]]
display_menu()
while True:
command = input("Command: ")
if command == "list":
list(movie_list)
elif command == "add":
add(movie_list)
elif command == "del":
delete(movie_list)
elif command == "find": #added find command
rating=input("Enter rating:")#taking the rating
find_by_rating(movie_list,rating)#the call
elif command == "exit":
break
else:
print("Not a valid command. Please try again.\n")
print("Bye!")
if __name__ == "__main__":
main()
In: Computer Science
The original Occupational and Safety Health Act was passed to correct the large n umber of unsafe conditions in the workplace. There is ample evidence that the Act has reduced injuries and deaths in major injuries. Today's workplace is evolving and is very different than those of 50 years ago. In this unit's discussion board, give your opinion on the changes we see in employment and in the nature of work that may impact how we look at OSHA today. What new conditions should OSHA address that may not have been part of the original thought? Does today's workforce, for example, experience more separation due to remote worker options? If some emotional or psychological issues arise, should OSHA address those?
In: Operations Management
West Corp. issued 25-year bonds two years ago at a coupon rate of 5.3 percent. The bonds make semiannual payments. If these bonds currently sell for 105 percent of par value, what is the YTM? Please show work/steps and formula used ( do not solely use calculator to show work). Thank you
In: Finance
Write exactly 3 sentences.
Question: Before they introduced streaming services, how did Netflix use innovation to gain a competitive advantage over its Blockbuster?
In: Operations Management
Identify the advantages and disadvantages of monetary-unit sampling.
In: Finance
The major issues of the health care system in the United States are the cost of health care, access to health care and quality of health care.
In a minimum of 250 words list and explain an example of each of the 3 major issues.
In: Nursing
Write a C++ program that takes two sets ’A’ and ’B’ as input read from the file prog1 input.txt. The first line of the file corresponds to the set ’A’ and the second line is the set ’B’. Every element of each set is a character, and the characters are separated by space. Implement algorithms for the following operations on the sets. Each of these algorithms must be in separate methods or subroutines. The output should be written in the file prog1 output.txt. Write a title before the output of each operation. 1. Union 2. Intersection 3. A - B 4. Decide if (A ⊂ B). Program 2 – 50 points Write a program that takes three sets ’A’, ’B’, ’C’ as input read from the file prog2 input.txt. The first line of the file corresponds to the set ’A’, the second line is the set ’B’, and the third line is the set ’C’. Every element of each set is a character, and the characters are separated by space. Implement algorithms for the following operations on the sets. Each of these algorithms must be in separate methods or subroutines. The output should be written in the file prog2 output.txt and the standard output. Write a title before the output of each operation. 1. (A∪B)∪C. 2. A∪(B∩C). 3. (A∪B)∩(A∪C). HINTS You may want to use arrays. Pay special attention to the parentheses because they indicate the order. For example: (A ∪ B) ∪ C means to compute (A ∪ B) first, and then ∪C. Consider reusing the algorithms for union and intersection that you have defined already. For example, to compute (A ∪ B) ∪ C: First, compute A ∪ B using the function that computes the union that you already defined. Let’s say that you store that result in an array R. Then, compute R ∪ C using the function that computes the union that you already defined.
In: Computer Science
In: Operations Management
1. Articulate the aspects of the university environment to
consider as they adopt and implement ERM.
2. Describe the differences between formal structural and collegial
organizational models as they relate to goal setting, decision
making, and leadership.
3. Analyze strategies utilized at one higher education institution
to adopt ERM processes to fit the decentralized academic
environment.
In: Computer Science
Reimpelment a function called bubble_sort that has the following prototype.
bubble_sort(int *array, int size, pointer to a function)
Pre condition
array - a pointer to a an array of size element.
pointer to function - a pointer to a function that compares two
values (depending on sorting in ascending order or descending
order)
Post condition
Sort the array in ascending or descending based on the the pointer
to a function.
Call the function bubble_sort to sort the array in
ascending
Display the sorting array.
Call the function bubble_sort to sort the array in descending
Display the sorting array.
use a list of integers from a file called data.txt
Here is the content of the file data.txt.
9
8
4
7
2
9
5
6
1
3
In: Computer Science
Suppose you have developed a social media management tool that
you’ve made available as a service to everyone on your office
network. Due to its success, you plan to expand by publicizing and
providing the service to any client on the World Wide Web.
What problems might you expect as your service is requested by an
increasing number of clients, and what are some of the things you
might do to solve the problems?
In: Computer Science
Two of the main goals of International Consumer Law is to set a global minimum consumer protection standard and to remove obstacles to cross-border trade. The United Nations Guidelines on Consumer Protection (UNGCP) were promulgated to provide guidance as to the minimal standards of protection within the global market. The United Nations Conference for Trade and Development (UNCTAD) promotes those guidelines to member states. In addition to U.N. activity, the International Consumer Protection and Enforcement Network (ICPEN) was established in 1992 to promote international protection for consumers by creating a collaborative forum to address cross-border misconduct.
The UN Guidelines are designed with the intention of providing a inspirational model. Describe the fundamental principles upon which it is based. In addition, identify the long-term goals of the ICPEN in its effort to motivate cross-border traders to engage in acceptable conduct. Describe a couple of the mechanisms that the ICPEN use to encourage compliance.
In: Operations Management
Q20: Dow Jones Industrial Index has reached historical high recently. What factors in the stock valuation model have driven the stock market index to the historical high level?
In: Finance