Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

. . 2. Declare and initialize the following constants and variables. A floating-point constant to store the minimum balance for the business account initialized to

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

. . 2. Declare and initialize the following constants and variables. A floating-point constant to store the minimum balance for the business account initialized to 10000.00. A floating-point constant to store the minimum balance for the personal account initialized to 1000.00. A floating-point variable to store the current balance for the business account initialized to 10000.00. A floating-point variable to store the current balance for the personal account initialized to 1000.00. 3. Declare an enumeration constant with values Business and Personal and assign suitable integer values to each data item. 4. Using a suitable message, prompt the user for the name on the account. The name can have multiple words. Only alphabets (A-Z or a-z) and whitespaces are permitted in the account name. If the user enters any other characters in the name, you need to generate an error message and ask for the name again. Your program must keep on asking the user to enter the name until the user enters it correctly.(SEE SAMPLE OUTPUT 1) The user may type the name in either uppercase or lowercase, but you need to convert every initial to uppercase. (SEE SAMPLE OUTPUTS) 5. Using a suitable message, prompt the user for the number of the account. The account number must be a 6 digit number. If the user enters any other account number, generate an error message and ask the user to enter the number again. Your program must keep on asking the user to enter the number until the user enters it correctly. (SEE SAMPLE OUTPUT 1) O O . . 6. Inside a switch-case block with a default case, implement the following features. Ask the user to choose which account the user wants to access - Business or Personal. o Use a suitable integer value to get the choice from the user. You must use the enumeration constants to set up your cases. . . . You must use a variable of your enumeration constant type for switching control. If the user chooses a Business account o Prompt the user for a transaction to process. The transaction can be a positive or a negative value. Positive transactions are deposits and negative transactions are withdrawals. o If the current balance falls below the required minimum balance for a business account, there is a 10$ penalty (decrease current balance by $10 for every new transaction) until the current balance updates to at least the minimum required balance. (SEE SAMPLE OUTPUT 3) o If the current balance is below the minimum required balance, remind the user that the account is losing 10$ for every transaction using a suitable message. (SEE SAMPLE OUTPUT 3) If the user chooses a Personal account o Prompt the user for a transaction to process. The transaction can be a positive or a negative value. Positive transactions are deposits and negative transactions are withdrawals. olf any transaction drops the current balance below the minimum personal balance, the transaction will be denied with a suitable message to the user. (SEE SAMPLE OUTPUT 2) o Note that for personal accounts the current balance will never be less than the minimum balance and hence there are no provision of penalties either If the user enters a wrong choice, use the default case to provide an error message and ask the user to make the choice again. o Your program needs to keep on asking the user for the choice until the user chooses a correct choice. (SEE SAMPLE OUTPUT 1) Display the current balance in either case after each successful transaction. (SEE SAMPLE OUTPUTS) . . 7. Your program needs be able to process more than one transaction. After successfully processing a transaction, ask the user if the user wants to process another transaction. If the user chooses to process another transaction, use a suitable loop to ask the user about the type of account and the transaction to process (i.e. basically repeat Step 6). (SEE SAMPLE OUTPUT 4) 8. Display the following results to the user with suitable messages. The name on the account. Note that the displayed name must reflect the processing of Step 4. The account number of the account but in encrypted form. o Increment the actual account number with a seeded random integer between 200001 and 300000, inclusive o Note that the addition may increase a 6 digit number to a 7 digit number, in that case discard the first digit. o For example, if the actual account number is 999999 and the randomly generated number is 300000, the sum is 1299999 and the encrypted account number is 299999, with the leading 7th digit discarded. The current business and personal account balances. . o Make sure the number of digits after the decimal point is 2 digits and there is a $ sign in front of the number (for example, $12562.65 ) DESIGN (ALGORITHM): On a piece of paper (or word processor), write down the algorithm, or sequence of steps, that you will use to solve the problem. You may think of this as a "recipe" for someone else to follow. Continue to refine your "recipe until it is clear and deterministically solves the problem. Be sure to include the steps for prompting for input, performing calculations, and displaying output. You should attempt to solve the problem by hand first (using a calculator as needed) to work out what the answer should be for a few sets of inputs. Type these steps and calculations into a document (i.e., Word, text, or PDF) that will be submitted along with your source code. Note that if you do any work by hand, images (such as pictures) may be used, but they must be clear and easily readable. This document shall contain both the algorithm and any supporting hand-calculations you used in verifying your results. Here are some sample outputs to help you write the code. The items in bold are entered by the user on the terminal as input data. SAMPLE OUTPUT 1 $./a.out Computer Science and Engineering CSCE 1030 - Computer Science I Student Name EUID euid@my.unt.edu 1 Enter your name:John7 smith Your name can only have alphabets or spaces. Enter again. Enter your name: john c smits Your name can only have alphabets or spaces. Enter again. Enter your name: john c smith Enter your account number:2568 9745 Your account number is a 6-digit number. Enter again:55 Your account number is a 6-digit number. Enter again: 123456 What is your account type?O for Business, 1 for Personal :3 Wrong choice. Please enter again. What is your account type ?0 for Business, 1 for Personal:8 Wrong choice. Please enter again. What is your account type?0 for Business, 1 for Personal: 0 Enter transaction:2000 Business Balance: $12000 Do you want to pocas another transaction? Y/N: Name:Jolu. C Sm.ll. Account Numbe: (Encrypted : 394797 Business Pa ance: $12000.00 Personal Ra ance:S100D.OD SAMPLE OUTPUT 2 $/a.out +----- 1 1 Computer azience and Engineering 1 CSC 1030 - Computer science 1 1 Student Name EVID cuidemy.unt.edu +----- ------------------ Enter your name: John Smith Enter your account number: 999999 What is your account type 70 tor B:181neas, 1 for Personal:1 Enter transact oni-10000 Your personal balance sunet be less than minimo ba ance. Prane action denied. Persural La-arce: 31000 Do you want to proand another transaction? Y/N: Name:John Smith Account Numbe: (Encrypted: :271340 Business Balance: 510000.00 Personal Balance: 51000.00 Your balance ie less than the required inimum. There will be a $20.00 fee for every transaction Business Beleuce: $-40020 Do you want to procesa another transaction? Y/N:y What is your account type20 for Businesa, 1 for Personal: 0 Enter tramantinn: 100000 Your balance ia less than the required minimum. There will be a $20.00 fee for every transaction. Business Balance: $39970 Do you want to process another transaction? YAN: What is your account typc?0 for Businesa, 1 for Personal: 0 Enter transaation: 5000 Business Balance: 964970 Do you want to process another teresaction? Y/N:n Name: Shaila HARTS Account Number Encrypted): 451179 Business Balance: 964970.00 Fersonal Balance: $100.00 SAMPLE OUTPUT 4 $ /a.out Computer Science and Engineering CSCE 10.20 - Computer Science I Student Name RUTD euidemy.unt.edu SAMPLE OUTPUT : $ ./a.out 1 1 Computer anionce and Enginering 1 csc 1030 - Computer anience ! 1 Student Name EUID euid my unt.edu +-------------------------- Enter your name: sheila HARRIS Enter your account number: 555555 What is your account type for Business, 1 for Personal: Enter transaction:-50000 Business Balance: 3-40000 Do You Want Lo Diveas anelle: Liandaelion? Y/N:y What is your accou- Lyo? For Business, I for Personal: 0 Enter Lane action: 10000 Your balance is less than the recuired menim. There will be a $10.00 Fee for every transaction. Business Darance: 3-30010 Do you want to proceas another transaction? Y/NY What is your account type70 for Business, i tor Tersonal: 0 Enter transactioni-10000 Enter your : abcd afgh Enter your ancount. mmber:100000 what is your account type20 for Bunincon, 1 for Personal: 0 Enter trannantion: 10000 Business Balanen: $20000 Do you want to procese another transaction? Y/N: et se your account type?0 fee Business, 1 for Personal:1 Ester transaction: 2000 Personal Balance:$3000 Do you want to process another treaction? Y/N:D Nume: Abcd Egh Account Number Encryptec): 371341 Business Buluna: 20000.00 Personal Balunen: $3000.00 TESTING: Test your program to check that it operates as desired with a variety of inputs. Then, compare the answers your code aves with the ones you get from hand calculations. SUBMISSION

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_2

Step: 3

blur-text-image_3

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

Domain Transfer Learning With 3q Data Processing

Authors: Ahmed Atif Hussain

1st Edition

B0CQS1NSHF, 979-8869061805

More Books

Students also viewed these Databases questions